//TH-Header //***************************************************************************************** // Copyright (c) 2014 KURANT Project // All rights reserved. // // $FileName : oWorkspaceSelector.dg // $ProjectName : The Hammer 2.0 // $Authors : Wil van Antwerpen, Michael Kurz, Sergey V. Natarov, Bernhard Ponemayr // $Created : 01.25.2014 01:08 // $Type : LGPL // // Contents: Workspace Selector // //***************************************************************************************** //TH-RevisionStart //TH-RevisionEnd // Project Object Structure // oWorkspaceSelector is a dbModalPanel // BD_Registry is a Windows_Registry // KDir is a Array // oImageList is a cImageList // List1 is a TreeView // oSelectBtn is a Button // oCancelBtn is a Button // Register all objects Register_Object BD_Registry Register_Object KDir Register_Object List1 Register_Object oCancelBtn Register_Object oImageList Register_Object oSelectBtn Register_Object oWorkspaceSelector Register_Function Retrive_Object_Name String sFile Returns String //Use xGlobal.pkg Use DfTreeVw.pkg Object oWorkspaceSelector is a dbModalPanel Property String psRetPath Public "" Object BD_Registry is a Windows_Registry Property String piSourceString Public "" Object KDir is an Array End_Object Function xIDKDir Returns Integer Function_Return (Object_ID(KDir(Current_Object))) End_Function Function Reg_Key_Enum Integer iKey String szKeyName returns Integer String sName sName2 Arbvar Integer ArrayID xItem get piSourceString to sName Set_Registry_Root to HKEY_LOCAL_MACHINE 'Software' Get_Foreign_Profile_String sName szKeyName "DDSrcPath" to sName2 if sName2 gt " " Begin get xIDKDir to ArrayID get Item_Count of ArrayID to xItem if sName2 gt " " set Array_Value of ArrayID Item xItem to (szKeyName) //+" - "+sName2) End Function_Return 1 End_Function End_Object set Label to "Select Workspace" set Size to 266 205 set Location to 7 21 Object oImageList is a cImageList set Location to 0 1 Procedure OnCreate Integer iObj get AddTransparentImage 'ClosFold.bmp' clFuchsia to iObj get AddTransparentImage 'OpenFold.bmp' clFuchsia to iObj End_Procedure End_Object // oImageList Object List1 is a TreeView set Size to 226 190 set Location to 5 5 set ImageListObject to (oImageList(self)) Procedure onItemChanged Handle hItemNew Handle hItemOld Handle hItem String sVal //Forward Send hItemNew hItemOld get ItemFullPath hItemNew to sVal End_Procedure Procedure OnItemDblClick Handle hItemNew String sVal get ItemFullPath hItemNew to sVal if (sVal Contains "\") Begin //Send Info_Box sVal set psRetpath to sVal send Exit_Application End End_Procedure Procedure OnItemEnter Handle hItemNew String sVal get ItemFullPath hItemNew to sVal if (sVal Contains "\") Begin //Send Info_Box sVal set psRetpath to sVal send Exit_Application End End_Procedure Procedure onCreateTree String sVal Integer iTel iSn iMode iJub Handle hItemRoot hItemChild get Item_Count of (kdir(BD_Registry(Self))) to iTel for iSn from 0 to (iTel-1) move (Value( //move (kDir(BD_Registry(Self),iSn)) to sVal if (sVal="5") Begin get AddTreeItem of (List1(Self)) sVal 0 iJub 0 1 to hItemRoot move 5 to iMode End Else if (sVal="6") Begin get AddTreeItem of (List1(Self)) sVal 0 iJub 0 1 to hItemRoot move 6 to iMode End Else if (sVal="7") Begin get AddTreeItem of (List1(Self)) sVal 0 iJub 0 1 to hItemRoot move 7 to iMode End Else Begin if (iMode=5) get AddTreeItem of (List1(Self)) sVal hItemRoot iJub 0 1 to hItemChild Else if (iMode=6) get AddTreeItem of (List1(Self)) sVal hItemRoot iJub 0 1 to hItemChild Else if (iMode=7) get AddTreeItem of (List1(Self)) sVal hItemRoot iJub 0 1 to hItemChild //Send Info_Box sVal End Increment iJub Loop End_Procedure End_Object // List1 Object oSelectBtn is a Button set Label to "Select" set Location to 234 93 Procedure OnClick String sVal Handle hItemNew get CurrentTreeItem of (list1(Self)) to hItemNew get ItemFullPath Of (list1(self)) hItemNew to sVal if (sVal Contains "\") Begin //Send Info_Box sVal set psRetpath to sVal send Exit_Application End End_Procedure // OnClick End_Object // oSelectBtn Object oCancelBtn is a Button set Label to "Cancel" set Location to 234 145 Procedure OnClick String sVal Handle hItemNew get CurrentTreeItem of (list1(Self)) to hItemNew get ItemFullPath hItemNew to sVal if (sVal Contains "\") Begin //Send Info_Box sVal set psRetPath to "" send Exit_Application End End_Procedure // OnClick End_Object // oCancelBtn Function Select_WS Returns String String sValData sPath sGot_It sPath2 sPath3 sPath4 sSuper sMappe sRet Integer iTel iSn Handle hItemRoot hItemChild set psRetPAth to "" send Delete_Data to (kDir(BD_registry(Self))) set Array_Value of (kDir(BD_Registry(Self))) item 0 to "5" move "Data Access Corporation\Visual DataFlex\5\Workspaces" to sValData set piSourceString of (BD_Registry(Self)) to sValData get EnumRegistryKey of (BD_Registry(Current_Object)) ("Software\"+sValData) to iTel get Item_Count of (kDir(BD_Registry(Self))) to iTel set Array_Value of (kDir(BD_Registry(Self))) item iTel to "6" move "Data Access Corporation\Visual DataFlex\6\Workspaces" to sValData set piSourceString of (BD_Registry(Self)) to sValData get EnumRegistryKey of (BD_Registry(Current_Object)) ("Software\"+sValData) to iTel get Item_Count of (kDir(BD_Registry(Self))) to iTel set Array_Value of (kDir(BD_Registry(Self))) item iTel to "7" move "Data Access Corporation\Visual DataFlex\7\Workspaces" to sValData set piSourceString of (BD_Registry(Self)) to sValData get EnumRegistryKey of (BD_Registry(Current_Object)) ("Software\"+sValData) to iTel send Popup_Modal get psRetPath to sRet Function_Return sRet End_Function End_Object // oWorkspaceSelector Procedure Select_Wkspace Integer iNoSet# Integer iNoSet String sGot_It if (Num_Arguments>=1) move iNoSet# to iNoSet get Select_Ws of (oWorkSpaceSelector(Self)) to sGot_IT if (iNoSet=0) send Reg_All_Paths sGot_It End_Procedure Procedure Reg_All_Paths String sGot_It String sValData sPath sPath2 sPath3 sPath4 sSuper sMappe sVal sVal2 sSecond Integer iItem move sGot_It to sSuper set psCWorkSpace to sGot_It Set_Registry_Root to HKEY_LOCAL_MACHINE 'Software' if ((Left(sGot_IT,2))="5\") Begin move "Data Access Corporation\Visual DataFlex\5\Defaults" to sValData Get_Foreign_Profile_String sValData "" "dfPath" to sPath move (Replace("5\",sGot_It,"")) to sGot_It move "Data Access Corporation\Visual DataFlex\5\Workspaces" to sValData Get_Foreign_Profile_String sValData sGot_It "DDSrcPath" to sPath2 Get_Foreign_Profile_String sValData sGot_It "DataPath" to sPath3 Get_Foreign_Profile_String sValData sGot_It "AppSrcPath" to sPath4 move "Data Access Corporation\Visual DataFlex\5\DFComp" to sValData Get_Foreign_Profile_String sValData "" "MakePath" to sSecond End if ((Left(sGot_IT,2))="6\") Begin move "Data Access Corporation\Visual DataFlex\6\Defaults" to sValData Get_Foreign_Profile_String sValData "" "dfPath" to sPath move (Replace("6\",sGot_It,"")) to sGot_It move "Data Access Corporation\Visual DataFlex\6\Workspaces" to sValData Get_Foreign_Profile_String sValData sGot_It "DDSrcPath" to sPath2 Get_Foreign_Profile_String sValData sGot_It "DataPath" to sPath3 Get_Foreign_Profile_String sValData sGot_It "AppSrcPath" to sPath4 move "Data Access Corporation\Visual DataFlex\6\DFComp" to sValData Get_Foreign_Profile_String sValData "" "MakePath" to sSecond End Else if ((Left(sGot_IT,2))="7\") Begin move "Data Access Corporation\Visual DataFlex\7\Defaults" to sValData Get_Foreign_Profile_String sValData "" "dfPath" to sPath move (Replace("7\",sGot_It,"")) to sGot_It move "Data Access Corporation\Visual DataFlex\7\Workspaces" to sValData Get_Foreign_Profile_String sValData sGot_It "DDSrcPath" to sPath2 Get_Foreign_Profile_String sValData sGot_It "DataPath" to sPath3 Get_Foreign_Profile_String sValData sGot_It "AppSrcPath" to sPath4 move "Data Access Corporation\Visual DataFlex\7\DFComp" to sValData Get_Foreign_Profile_String sValData "" "MakePath" to sSecond End set psDFPath to (sPath2+";"+sPath3+";"+sPath+";"+sPath4+";C:\BDBIN"+";"+sSecond) Set_DFPath to (sPath2+";"+sPath3+";"+sPath+";"+sPath4+";C:\BDBIN"+";"+sSecond) Set_Attribute DF_OPEN_PATH to (sPath2+";"+sPath3+";"+sPath+";"+sPath4+";C:\BDBIN"+";"+sSecond+";H:\aofacces") set psCompPath to sSecond set psDDSrcPath to sPath2 set psDataPath to sPath3 set psAppsrcPath to sPath4 if (sPath2 contains ";") Begin move (Left(sPath2,((Pos(";",sPath2))-1))) to sPath2 End set psMainPath to sPath2 set Label to ("Create and modify DD"+"ï"+"s. [Workspace: "+sSuper+"]") Get_File_Path ("FileList.CFG") to sMappe set psCurrentFilelist to sMappe if (sMappe>"") Begin Set_Attribute DF_FILELIST_NAME to sMappe End Broadcast send Clear_All Broadcast send Read_In_Classes sPath4 End_Procedure