Advertisement
Guest User

Matt Panzer

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