Advertisement
Guest User

Gio Pet

a guest
Feb 12th, 2010
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 22.69 KB | None | 0 0
  1. {SMART PASTE_Command to control the automatic creation of new classes when Copy/Pasting across Drawings.
  2. Copyright (C) 2010  Giovanni Petrolito}
  3.  
  4.  
  5. PROCEDURE Smart_Paste;
  6.  
  7.  
  8. VAR
  9.         ClassNames                      :DYNARRAY[] of STRING;
  10.         NewClassNames                   :DYNARRAY[] of STRING;
  11.         ExtraClassNames                 :DYNARRAY[] of STRING;
  12.        
  13.  
  14.         countClasses, NewcountClasses   :INTEGER;
  15.         diff, StartClass                :INTEGER;
  16.         index                           :INTEGER;
  17.         clicks                          :INTEGER;
  18.         ClassOptions                    :INTEGER;
  19.        
  20.         Didcancel    :BOOLEAN;
  21.         canceled     :BOOLEAN;
  22.        
  23.  
  24.         OldClass                        :STRING;
  25.         NewClass                        :STRING;
  26.         to_be_assigned                  :STRING;
  27.         assign_to                       :STRING;
  28.        
  29.        
  30.                
  31. { ***************************************************************************************************************** }        
  32.                 { BEGINNING OF SUB-PROCEDURES }        
  33. { ***************************************************************************************************************** }        
  34.        
  35.  
  36.  
  37.         PROCEDURE Populate_Array1;
  38.  
  39.         VAR
  40.                 x       :INTEGER;
  41.                 y       :INTEGER;
  42.                 w       :INTEGER;
  43.  
  44.  
  45.                 BEGIN
  46.                 countClasses:=CLASSNUM;
  47.                 ALLOCATE ClassNames [1..countClasses];
  48.  
  49.                         FOR x:= 1 TO countClasses DO BEGIN
  50.                                 y:=x;
  51.                                 CLassnames[y] := ClassList(x);                  
  52.                         END;
  53.         END;
  54.  
  55. { ***************************************************************************************************************** }      
  56.  
  57.         PROCEDURE Populate_Array2;    
  58.  
  59.         VAR
  60.                 x       :INTEGER;
  61.                 y       :INTEGER;
  62.                 w       :INTEGER;
  63.  
  64.         BEGIN
  65.                 ALLOCATE NewClassNames [1..NewcountClasses];
  66.                
  67.                 FOR x:= 1 TO NewcountClasses DO BEGIN
  68.  
  69.                         y:=x;
  70.                         NewClassNames[y] := ClassList(x);  
  71.                         END;          
  72.         END;
  73.  
  74. { ***************************************************************************************************************** }
  75.  
  76.         PROCEDURE Populate_Array_Extra;
  77.  
  78.         VAR
  79.                 x       :INTEGER;
  80.                 y       :INTEGER;
  81.                 w       :INTEGER;
  82.  
  83.  
  84.                 BEGIN
  85.                         canceled:=False;
  86.                         diff:=(NewcountClasses - countClasses);
  87.                         StartClass:=(NewcountClasses - diff)+1;
  88.                         ALLOCATE ExtraClassNames [1..diff];    
  89.                         y:=1;                  
  90.                        
  91.                         FOR x:=(StartClass) TO (NewcountClasses) DO BEGIN
  92.                             IF  y<=diff THEN BEGIN
  93.                                 ExtraClassNames[y] := NewClassNames[x];                                
  94.                                 y:=y+1;
  95.                             END;
  96.                         END;
  97.                 END;
  98.        
  99. { ***************************************************************** }        
  100.        
  101.        
  102.         PROCEDURE dialog1_Main;
  103.        
  104.         CONST
  105.             kStartStringAt = 3000;
  106.             kOK           = 1;
  107.             kCancel       = 2;
  108.             kUndo_Btn     = 4;
  109.             kPaste_Btn    = 5;
  110.             kAssign       = 6;
  111.             kGroupBox7    = 7;
  112.             kGroupBox14   = 14;
  113.             kGroupBox15   = 15;
  114.             kGroupBox25   = 25;
  115.             kGroupBox26   = 26;
  116.             kNEWclsnm     = 40;
  117.             kEXclsnm      = 41;
  118.             kStaticText63 = 63;
  119.             kStaticText64 = 64;
  120.  
  121.             kRight        = 1;
  122.             kBottom       = 2;
  123.             kLeft         = 3;
  124.             kResize       = 0;
  125.             kShift        = 1;
  126.  
  127.             kTextOnly     = 0;
  128.             kIconOnly     = 1;
  129.             kTextIcon     = 3;
  130.             kStatic       = 1;
  131.             kRadio        = 2;
  132.             kMulti        = 3;
  133.             kCol0         = 0;
  134.             kCol1         = 1;
  135.             kRow1         = 1;
  136.         VAR
  137.             dialog1             :INTEGER;
  138.             kImageCheckNEW      :INTEGER;
  139.             kImageBlankNEW      :INTEGER;
  140.             kImageSheetNEW      :INTEGER;
  141.             kImageViewNEW       :INTEGER;
  142.    
  143.             kImageCheckEX       :INTEGER;
  144.             kImageBlankEX       :INTEGER;
  145.             kImageSheetEX       :INTEGER;
  146.             kImageViewEX        :INTEGER;
  147.    
  148.             cnt                 :INTEGER;
  149.             int                 :INTEGER;
  150.             ndx                 :INTEGER;
  151.    
  152.             numOfClass          :INTEGER;
  153.             classname           :INTEGER;
  154.    
  155.             xmlID               :LONGINT;
  156.    
  157.             boo                 :BOOLEAN;
  158.             Select_more         :BOOLEAN;
  159.             Select_one          :BOOLEAN;
  160.             str                 :STRING;
  161.    
  162.             {$Include _DialogBuilderUtilities.txt}
  163.  
  164.  
  165.  
  166.             FUNCTION GetPlugInString(ndx :INTEGER) :STRING;
  167.                 BEGIN
  168.                 CASE ndx OF
  169.                     {Static Text}
  170.                     3001: GetPlugInString := 'OK';
  171.                     3002: GetPlugInString := 'Cancel';
  172.                     3003: GetPlugInString := 'Smart Paste';
  173.                     3004: GetPlugInString := 'Undo';
  174.                     3005: GetPlugInString := 'Add';
  175.                     3006: GetPlugInString := 'Assign';
  176.                     3007: GetPlugInString := 'Controls';
  177.                     3014: GetPlugInString := 'Untitled';
  178.                     3015: GetPlugInString := 'Untitled';
  179.                     3025: GetPlugInString := '';
  180.                     3026: GetPlugInString := '';
  181.                     3063: GetPlugInString := 'New Incoming Classes:';
  182.                     3064: GetPlugInString := 'Existing Classes:';
  183.  
  184.                     {Help Text}
  185.                     4001: GetPlugInString := 'Accepts dialog data.';
  186.                     4002: GetPlugInString := 'Cancels operation without changes.';
  187.                     4004: GetPlugInString := 'A push button control.';
  188.                     4005: GetPlugInString := 'A push button control.';
  189.                     4006: GetPlugInString := 'A push button control.';
  190.                     4007: GetPlugInString := '';
  191.                     4014: GetPlugInString := '';
  192.                     4015: GetPlugInString := '';
  193.                     4025: GetPlugInString := 'A group box control.';
  194.                     4026: GetPlugInString := 'A group box control.';
  195.                     4040: GetPlugInString := 'A list box control.';
  196.                     4041: GetPlugInString := 'A list box control.';
  197.                     4063: GetPlugInString := 'Static text control.';
  198.                     4064: GetPlugInString := 'Static text control.';
  199.                 END;
  200.             END;
  201.  
  202. { ***************************************************************************************************************** }
  203.  
  204.             FUNCTION GetStr(ndx :INTEGER) :STRING;
  205.                 BEGIN
  206.                     GetStr := GetPlugInString(ndx + kStartStringAt);
  207.                 END;
  208.  
  209. { ***************************************************************************************************************** }
  210.  
  211.             PROCEDURE dialog1_Setup;
  212.                 BEGIN
  213.                     dialog1 := CreateResizableLayout(GetStr( 3), TRUE, GetStr(kOK), GetStr(kCancel), FALSE, TRUE);
  214.                     CreatePushButton          (dialog1, kUndo_Btn,      GetStr(kUndo_Btn));
  215.                     CreatePushButton          (dialog1, kPaste_Btn,     GetStr(kPaste_Btn));
  216.                     CreatePushButton          (dialog1, kAssign,        GetStr(kAssign));
  217.                     CreateGroupBox            (dialog1, kGroupBox7,     GetStr(kGroupBox7), TRUE);
  218.                     CreateGroupBox            (dialog1, kGroupBox14,    GetStr(kGroupBox14), FALSE);
  219.                     CreateGroupBox            (dialog1, kGroupBox15,    GetStr(kGroupBox15), FALSE);
  220.                     CreateGroupBox            (dialog1, kGroupBox25,    GetStr(kGroupBox25), TRUE);
  221.                     CreateGroupBox            (dialog1, kGroupBox26,    GetStr(kGroupBox26), TRUE);
  222.                     CreateLB                  (dialog1, kNEWclsnm,      32, 10);
  223.                     CreateLB                  (dialog1, kEXclsnm,       32, 10);
  224.                     CreateStaticText          (dialog1, kStaticText63,  GetStr(kStaticText63), -1);
  225.                     CreateStaticText          (dialog1, kStaticText64,  GetStr(kStaticText64), -1);
  226.                     SetFirstLayoutItem(dialog1, kGroupBox15);
  227.                     SetFirstGroupItem (dialog1, kGroupBox15,    kGroupBox26);
  228.                     SetFirstGroupItem (dialog1, kGroupBox26,    kStaticText63);
  229.                     SetBelowItem      (dialog1, kStaticText63,  kNEWclsnm,      0, 0);
  230.                     SetRightItem      (dialog1, kGroupBox26,    kGroupBox7,     0, 0);
  231.    
  232.                     SetFirstGroupItem (dialog1, kGroupBox7,     kAssign);
  233.                     SetBelowItem (dialog1, kGroupBox7,     kPaste_Btn, 3.25, -40 );
  234.                     SetRightItem (dialog1,kPaste_Btn,     kUndo_Btn, -11.47, 10 );
  235.    
  236.                     SetRightItem      (dialog1, kGroupBox7,     kGroupBox14,    0, 0);
  237.                     SetFirstGroupItem (dialog1, kGroupBox14,    kGroupBox25);
  238.                     SetFirstGroupItem (dialog1, kGroupBox25,    kStaticText64);
  239.                     SetBelowItem      (dialog1, kStaticText64,  kEXclsnm,       0, 0);
  240.    
  241.  
  242.                     AlignItemEdge(dialog1, kNEWclsnm,      kLeft,    2, kResize);
  243.                     AlignItemEdge(dialog1, kEXclsnm,       kRight,   2, kResize);
  244.  
  245.                     SetEdgeBinding        (dialog1, kUndo_Btn,      FALSE, FALSE, FALSE, FALSE);
  246.                     SetEdgeBinding        (dialog1, kPaste_Btn,     FALSE, FALSE, FALSE, FALSE);
  247.                     SetEdgeBinding        (dialog1, kAssign,        FALSE, FALSE, FALSE, FALSE);
  248.                     SetEdgeBinding        (dialog1, kGroupBox14,    TRUE, TRUE, TRUE, TRUE);
  249.                     SetEdgeBinding        (dialog1, kGroupBox15,    TRUE, TRUE, TRUE, TRUE);
  250.                     SetEdgeBinding        (dialog1, kGroupBox25,    TRUE, TRUE, TRUE, TRUE);
  251.                     SetEdgeBinding        (dialog1, kGroupBox26,    TRUE, TRUE, TRUE, TRUE);
  252.                     SetEdgeBinding        (dialog1, kNEWclsnm,      TRUE, TRUE, TRUE, TRUE);
  253.                     SetEdgeBinding        (dialog1, kEXclsnm,       TRUE, TRUE, TRUE, TRUE);
  254.                     SetEdgeBinding        (dialog1, kStaticText63,  FALSE, FALSE, TRUE, FALSE);
  255.                     SetEdgeBinding        (dialog1, kStaticText64,  FALSE, FALSE, TRUE, FALSE);
  256.                     SetProportionalBinding(dialog1, kNEWclsnm,      FALSE, FALSE, FALSE, FALSE);
  257.                     SetProportionalBinding(dialog1, kEXclsnm,       FALSE, FALSE, FALSE, FALSE);
  258.    
  259.                     FOR cnt := 1 TO 15 DO SetHelpString(cnt, GetStr(cnt + 1000));
  260.                 END;
  261.  
  262.             { ***************************************************************** }
  263.                         { PROCEDURES TO DEFINE BUTTONS BEHAVIOUR }
  264.             { ***************************************************************** }
  265.  
  266.             PROCEDURE Assign_Button;
  267.        
  268.             Var
  269.                     Selection, Remove, Assign   :Boolean;
  270.                        
  271.             Sel_ndx, Sel_cls            :Integer;
  272.            
  273.             temp_ndx1, temp_ndx2        :Integer;
  274.             temp_cls1, temp_cls2        :string;
  275.             list_name                   :STRING;       
  276.             list_image                  :Integer;      
  277.             list_number                 :INTEGER;
  278.            
  279.             LOC_ClassArray              :DYNARRAY[] of STRING;
  280.             LOC_ClassIndex              :DYNARRAY[] of INTEGER;
  281.            
  282.             atChoice    :Integer;
  283.             h           :handle;
  284.             x           :Integer;
  285.            
  286.            
  287.            
  288.             Procedure AssignThem(h :HANDLE);
  289.                 begin
  290.                     if GetClass(h) = LOC_ClassArray[x]  then SetClass(h, assign_to);
  291.                 end;
  292.            
  293.                
  294.                 BEGIN
  295.                     IF GetNumSelectedLBItems(dialog1, kEXclsnm)<>0 THEN BEGIN
  296.                            
  297.                         list_number := GetNumLBItems(dialog1, kEXclsnm);
  298.                                
  299.                         For atChoice:=0 to list_number Do Begin
  300.                             Selection := IsLBItemSelected(dialog1, kEXclsnm, atChoice);
  301.                                    
  302.                             If  Selection=True Then Begin
  303.                                 Assign := GetLBItemInfo(dialog1, kEXclsnm, atChoice, kCol0, assign_to, list_image);
  304.                                 x:=1;
  305.                             End;   
  306.                                
  307.                         End;
  308.                                
  309.                     IF GetNumLBItems(dialog1, kNEWclsnm)<>0 THEN BEGIN
  310.                            
  311.                         list_number := GetNumLBItems(dialog1, kNEWclsnm);
  312.                         Sel_cls := GetNumSelectedLBItems(dialog1, kNEWclsnm);
  313.                    
  314.                         if  Sel_cls=0 Then BEGIN
  315.                             AlrtDialog('No classes Selected');
  316.                         End;
  317.                                
  318.                         if  Sel_cls>0 Then BEGIN
  319.                             clicks := clicks+1;    
  320.                    
  321.                             ALLOCATE LOC_ClassArray[1..Sel_cls];
  322.                             ALLOCATE LOC_ClassIndex[1..Sel_cls];
  323.                             Sel_ndx:=1;    
  324.                            
  325.                             For atChoice:=0 to list_number Do Begin
  326.                                 Selection := IsLBItemSelected(dialog1, kNEWclsnm, atChoice);
  327.                                
  328.                                 If  Selection=True Then Begin
  329.                                     Assign := GetLBItemInfo(dialog1, kNEWclsnm, atChoice, kCol0, to_be_assigned, list_image);
  330.                        
  331.                                     LOC_ClassArray[Sel_ndx] := to_be_assigned;  
  332.                                     LOC_ClassIndex[Sel_ndx] := atChoice;
  333.                        
  334.                                     Sel_ndx:=Sel_ndx+1;
  335.                                 End;
  336.                        
  337.                             End;
  338.                        
  339.                             Sel_ndx:=(Sel_cls);
  340.                        
  341.                        
  342.                             {Sort the Array in Descending order to allow DeleteLBItem work in a Loop }
  343.                        
  344.                             For x:=1 to Sel_cls do BEGIN
  345.                        
  346.                                 if x<Sel_ndx Then Begin
  347.                            
  348.                            
  349.                                     temp_ndx1 := LOC_ClassIndex[Sel_ndx];
  350.                                     temp_cls1 := LOC_ClassArray[Sel_ndx];
  351.                            
  352.                                     temp_ndx2 := LOC_ClassIndex[x];
  353.                                     temp_cls2 := LOC_ClassArray[x];
  354.                                
  355.                                     LOC_ClassIndex[x] := temp_ndx1;
  356.                                     LOC_ClassArray[x] := temp_cls1;
  357.                            
  358.                                     LOC_ClassIndex[Sel_ndx] := temp_ndx2;
  359.                                     LOC_ClassArray[Sel_ndx] := temp_cls2;
  360.                                 End;   
  361.                                 Sel_ndx:=(Sel_ndx-1);
  362.                             End;    
  363.                            
  364.                    
  365.                             AlrtDialog(Concat('Selected Existing Class:  ', assign_to));
  366.                    
  367.                             For x:=1 to Sel_cls Do BEGIN
  368.                                 ForEachObject(AssignThem, SEL);
  369.                                 DelClass(LOC_ClassArray[x]);
  370.                                 Remove:=DeleteLBItem(dialog1, kNEWclsnm, LOC_ClassIndex[x]);   
  371.                             End;
  372.                         End;
  373.            
  374.                     END ELSE BEGIN
  375.                         AlrtDialog('No more classes need to be reassigned');
  376.                     End;   
  377.            
  378.                 END ELSE BEGIN
  379.                     AlrtDialog('SELECT ONE OF THE EXISTING CLASSES');
  380.                 End;
  381.             End;
  382.            
  383. { ***************************************************************************************************************** }                          
  384.             Procedure   Add_Button;
  385.             Var
  386.                 Selection, Remove, Assign   :Boolean;
  387.                 Add                         :Integer;
  388.            
  389.                 Sel_ndx, Sel_cls            :Integer;
  390.            
  391.                 temp_ndx1, temp_ndx2        :Integer;
  392.                 temp_cls1, temp_cls2        :string;
  393.                 list_name                   :STRING;       
  394.                 list_image                  :Integer;      
  395.                 list_number                 :INTEGER;
  396.            
  397.                 LOC_ClassArray              :DYNARRAY[] of STRING;
  398.                 LOC_ClassIndex              :DYNARRAY[] of INTEGER;
  399.                
  400.                 atChoice    :Integer;
  401.                 h           :handle;
  402.                 x           :Integer;
  403.                
  404.        
  405.             BEGIN
  406.            
  407.                 IF GetNumLBItems(dialog1, kNEWclsnm)<>0 THEN BEGIN
  408.                     list_number := GetNumLBItems(dialog1, kNEWclsnm);
  409.                
  410.                     Sel_cls := GetNumSelectedLBItems(dialog1, kNEWclsnm);
  411.                    
  412.                         if  Sel_cls=0 Then BEGIN
  413.                             AlrtDialog('No classes Selected');
  414.                         End;
  415.                                
  416.                     if  Sel_cls>0 Then BEGIN
  417.                        
  418.                         ALLOCATE LOC_ClassArray[1..Sel_cls];
  419.                         ALLOCATE LOC_ClassIndex[1..Sel_cls];
  420.                
  421.                         Sel_ndx:=1;    
  422.                         For atChoice:=0 to list_number Do Begin
  423.                             Selection := IsLBItemSelected(dialog1, kNEWclsnm, atChoice);
  424.                                
  425.                             If  Selection=True Then Begin
  426.                                 Assign := GetLBItemInfo(dialog1, kNEWclsnm, atChoice, kCol0, to_be_assigned, list_image);
  427.                        
  428.                                 LOC_ClassArray[Sel_ndx] := to_be_assigned;  
  429.                                 LOC_ClassIndex[Sel_ndx] := atChoice;
  430.                                
  431.                                 Sel_ndx:=Sel_ndx+1;
  432.                             End;
  433.                        
  434.                         End;
  435.                    
  436.                         Sel_ndx:=(Sel_cls);
  437.    
  438.                         {Sort the Array in Descending order to allow DeleteLBItem work in a Loop }
  439.                        
  440.                         For x:=1 to Sel_cls do BEGIN
  441.                        
  442.                             if x<Sel_ndx Then Begin
  443.                                                        
  444.                                 temp_ndx1 := LOC_ClassIndex[Sel_ndx];
  445.                                 temp_cls1 := LOC_ClassArray[Sel_ndx];
  446.                            
  447.                                 temp_ndx2 := LOC_ClassIndex[x];
  448.                                 temp_cls2 := LOC_ClassArray[x];
  449.                                
  450.                                 LOC_ClassIndex[x] := temp_ndx1;
  451.                                 LOC_ClassArray[x] := temp_cls1;
  452.                            
  453.                                 LOC_ClassIndex[Sel_ndx] := temp_ndx2;
  454.                                 LOC_ClassArray[Sel_ndx] := temp_cls2;
  455.                             End;   
  456.                             Sel_ndx:=(Sel_ndx-1);
  457.                        
  458.                         End;    
  459.                        
  460.                         For x:=1 to Sel_cls Do Begin
  461.                             AlrtDialog(Concat(LOC_ClassArray[x],' will be added to the Drawing'));
  462.                             Remove:=DeleteLBItem(dialog1, kNEWclsnm, LOC_ClassIndex[x]);
  463.                             Add:=InsertLBItem(dialog1, kEXclsnm, LOC_ClassIndex[x],LOC_ClassArray[x]);
  464.                         End;
  465.                     End;
  466.                
  467.                     END ELSE BEGIN
  468.                         IF GetNumLBItems(dialog1, kNEWclsnm)=0 THEN BEGIN
  469.                             AlrtDialog('No more classes can be added');
  470.                             END ELSE BEGIN
  471.                                 AlrtDialog('SELECT ONE OF THE EXISTING CLASSES');
  472.                         End;
  473.                     END;
  474.        
  475.             END;
  476.                    
  477.                    
  478. { **************************************************************************************************************** }
  479.         Procedure Undo_Button;
  480.         VAR
  481.             x :INTEGER;
  482.             Refresh :Boolean;
  483.            
  484.         BEGIN
  485.            
  486.             For x:=1 to Clicks do begin
  487.                 DoMenuTextByName('Undo',0);
  488.                 Refresh:=RefreshLB(dialog1,kNEWclsnm);
  489.             End;
  490.         END;
  491.  
  492.         { ***************************************************************** }
  493.                         { END DEFINITION OF BUTTONS BEHAVIOUR }
  494.         { ***************************************************************** }
  495.        
  496.         PROCEDURE dialog1_Handler(VAR item :LONGINT; data :LONGINT);
  497.  
  498.         Var
  499.             ColNum,TempI,I : Integer;
  500.             SheetTypeIcon : Integer;
  501.             BSB : Boolean;
  502.             BSS : String;
  503.             Selection : Boolean;
  504.  
  505.             LayerName,SelectedIconString : String;
  506.             SheetIconNumber,SelectedIconNumber : Integer;
  507.            
  508.            
  509.             atChoice    :Integer;
  510.             list_number :Integer;
  511.            
  512.             list_image  :Integer;
  513.             Assign      :Boolean;
  514.             x,y         :integer;
  515.            
  516.  
  517.         BEGIN
  518.             CASE item OF
  519.                 SetupDialogC:
  520.                     BEGIN
  521.  
  522.                         {Load images into kNEWclsnm.}
  523.                
  524.                         kImageCheckNEW := AddLBImage(dialog1, kNEWclsnm, 1, 11022);
  525.                         kImageBlankNEW := AddLBImage(dialog1, kNEWclsnm, 1, 11023);
  526.                         kImageSheetNEW := AddLBImage(dialog1, kNEWclsnm, 1, 11024);
  527.                         kImageViewNEW := AddLBImage(dialog1, kNEWclsnm, 1, 11025);
  528.                
  529.  
  530.                         {Define kNEWclsnm column 0.}
  531.                         cnt := InsertLBColumn        (dialog1, kNEWclsnm, kCol0, 'Class Name', 180);
  532.                         boo := SetLBControlType      (dialog1, kNEWclsnm, kCol0, kStatic);
  533.                         boo := SetLBItemDisplayType  (dialog1, kNEWclsnm, kCol0, kTextOnly);
  534.                
  535.                
  536.  
  537.                         {Initialize the rows to be used in kNEWclsnm.}
  538.                         FOR cnt := 1 TO diff DO BEGIN
  539.                             int := InsertLBItem(dialog1, kNEWclsnm, cnt, ExtraClassNames[cnt]);
  540.                         END;
  541.  
  542.                         {Insert the data into the columns and assign them to the rows.}
  543.                         LB_SetCell(dialog1, kNEWclsnm, kCol0, kRow1, 'ClassList('')');
  544.  
  545.                         EnableLBColumnLines(dialog1, kNEWclsnm, TRUE);
  546.                
  547.                                        
  548.                
  549.                         {Load images into kEXclsnm.}
  550.                         kImageCheckEX := AddLBImage(dialog1, kEXclsnm, 1, 11022);
  551.                         kImageBlankEX := AddLBImage(dialog1, kEXclsnm, 1, 11023);
  552.                         kImageSheetEX := AddLBImage(dialog1, kEXclsnm, 1, 11024);
  553.                         kImageViewEX := AddLBImage(dialog1, kEXclsnm, 1, 11025);
  554.                
  555.  
  556.                         {Define kEXclsnm column 0.}
  557.                         cnt := InsertLBColumn        (dialog1, kEXclsnm, kCol0, 'Class Name', 180);
  558.                         boo := SetLBControlType      (dialog1, kEXclsnm, kCol0, kStatic);
  559.                         boo := SetLBItemDisplayType  (dialog1, kEXclsnm, kCol0, kTextOnly);
  560.                
  561.  
  562.                         {Initialize the rows to be used in kEXclsnm.}
  563.                         FOR cnt := 1 TO countClasses DO BEGIN
  564.                             int := InsertLBItem(dialog1, kEXclsnm, cnt, CLassnames[cnt]);
  565.                         END;
  566.  
  567.                         {Insert the data into the columns and assign them to the rows.}
  568.                         LB_SetCell(dialog1, kEXclsnm, kCol0, kRow1, 'ClassList('')');
  569.  
  570.                         EnableLBColumnLines(dialog1, kEXclsnm, TRUE);
  571.                
  572.                     END;
  573.        
  574.                 { ***************************************************************** }
  575.                             { CALL PROCEDURES OF BUTTONS BEHAVIOUR}
  576.                 { ***************************************************************** }
  577.                 kCancel:
  578.                     BEGIN
  579.                         canceled:=TRUE;
  580.                         Didcancel:=canceled;   
  581.                     END;
  582.            
  583.                 kUndo_Btn:
  584.                     BEGIN
  585.                         Undo_Button;           
  586.                     END;
  587.            
  588.                 kPaste_Btn:
  589.                         BEGIN
  590.                             Add_Button;
  591.                         END;
  592.            
  593.                 kAssign:
  594.                         BEGIN
  595.                             Assign_Button;
  596.                         END;
  597.  
  598.                 kOK:
  599.                     BEGIN
  600.  
  601.                        
  602.  
  603.                     END;
  604.            
  605.                 kNEWclsnm:
  606.                     BEGIN
  607.                     {Insert the data into the columns and assign them to the rows.}
  608.            
  609.                         For cnt:= 1 to numOfClass do
  610.                
  611.                         LB_SetCell(dialog1, kNEWclsnm, 0, cnt, ClassList(cnt));
  612.                
  613.                
  614.                         EnableLBColumnLines(dialog1, kNEWclsnm, TRUE);
  615.                         Select_more:=EnableLBSingleLineSelection(dialog1, kNEWclsnm,FALSE);
  616.                     END;
  617.            
  618.                 kEXclsnm:
  619.                     BEGIN
  620.                     {Insert the data into the columns and assign them to the rows.}
  621.            
  622.                         For cnt:= 1 to numOfClass do
  623.                
  624.                         LB_SetCell(dialog1, kEXclsnm, 0, cnt, ClassList(cnt));
  625.                
  626.                
  627.                         EnableLBColumnLines(dialog1, kEXclsnm, TRUE);
  628.                         Select_one:=EnableLBSingleLineSelection(dialog1, kEXclsnm,TRUE);
  629.                     END;
  630.             END;
  631.    
  632.  
  633.         END;
  634.  
  635.     BEGIN   {of dialog1_Main}
  636.  
  637.         kImageCheckNEW  := 0;
  638.         kImageBlankNEW  := 0;
  639.         kImageSheetNEW  := 0;
  640.         kImageViewNEW   := 0;
  641.    
  642.         kImageCheckEX := 0;
  643.         kImageBlankEX := 0;
  644.         kImageSheetEX := 0;
  645.         kImageViewEX  := 0;
  646.    
  647.    
  648.         IF ResourceIsOK THEN dialog1_Setup;
  649.         IF RunLayoutDialog(dialog1, dialog1_Handler) = 1 then BEGIN
  650.    
  651.         END;
  652.     END;
  653.  
  654. { **************************************************************************************************************** }
  655.                                 { END OF ALL SUB-PROCEDURES }
  656. { **************************************************************************************************************** }
  657.  
  658. BEGIN  {of Smart_Paste}
  659.  
  660.            
  661.     Populate_Array1;
  662.     DoMenuTextByName('Paste',0);
  663.        
  664.     NewcountClasses:=CLASSNUM;
  665.  
  666.     IF (NewcountClasses=countClasses) THEN BEGIN   
  667.         Message('No New Classes Pasted');
  668.  
  669.     END ELSE BEGIN
  670.            
  671.         Populate_Array2;
  672.  
  673.         Populate_Array_Extra;
  674.  
  675.         index := 1;
  676.         clicks := 0;
  677.         dialog1_Main;
  678.         IF Didcancel THEN BEGIN
  679.             DoMenuTextByName('Undo',0);
  680.         END;
  681.     END;
  682.        
  683. END;
  684.  
  685. { ***************************************************************************************************************** }
  686.  
  687. RUN(Smart_Paste);
  688.        
  689.    
  690.  
  691. {This program is free software: you can redistribute it and/or modify
  692.     it under the terms of the GNU General Public License as published by
  693.     the Free Software Foundation, either version 3 of the License, or
  694.     (at your option) any later version.
  695.  
  696.     This program is distributed in the hope that it will be useful,
  697.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  698.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  699.     GNU General Public License for more details.
  700.  
  701.     You should have received a copy of the GNU General Public License
  702.     along with this program.  If not, see <http://www.gnu.org/licenses/>.}      
  703.    
  704.    
  705.      
  706.        
  707.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement