Changeset 801 for cprs/branches/tmg-cprs/CPRS-Chart/Options/fOptions.pas
- Timestamp:
- Jun 16, 2010, 8:23:07 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cprs/branches/tmg-cprs/CPRS-Chart/Options/fOptions.pas
r738 r801 140 140 Label3: TLabel; 141 141 editDropboxLocation: TEdit; 142 Label4: TLabel;143 BitBtn1: TBitBtn;142 lblDropBox: TLabel; 143 btnBrowseDropBox: TBitBtn; 144 144 dlgPickDir: TOpenDialog; 145 145 cbEnableScanning: TCheckBox; 146 Label5: TLabel;146 lblPollingInterval: TLabel; 147 147 editScannedLocation: TEdit; 148 BitBtn2: TBitBtn;149 Label6: TLabel;148 btnBrowseScannedImages: TBitBtn; 149 lblScannedImagesFolder: TLabel; 150 150 edtPolFreq: TEdit; 151 Label7: TLabel;151 lblSeconds: TLabel; 152 152 procedure FormCreate(Sender: TObject); 153 153 procedure FormDestroy(Sender: TObject); … … 195 195 procedure editScannedLocationChange(Sender: TObject); 196 196 procedure edtPolFreqChange(Sender: TObject); 197 procedure BitBtn1Click(Sender: TObject);198 procedure BitBtn2Click(Sender: TObject); //kt added 6/29/07197 procedure btnBrowseDropBoxClick(Sender: TObject); 198 procedure btnBrowseScannedImagesClick(Sender: TObject); //kt added 6/29/07 199 199 private 200 200 { Private declarations } … … 357 357 // initialize form 358 358 var i : integer; //kt added 6/29/07 359 begin 359 j : TImgTransferMethod; 360 begin 361 //kt start mod 362 cboTransMethod.Items.Clear; 363 for j := itmDropbox to itmRPC do cboTransMethod.Items.Add(IMAGE_TRANSFER_METHODS[j]); 364 //kt end mod 360 365 LoadNotifications; 361 366 LoadOrderChecks; 362 LoadImageSettings; 363 FdirtyImageSettings := false; 367 LoadImageSettings; //kt 368 FdirtyImageSettings := false; //kt 364 369 FdirtyNotifications := false; 365 370 FdirtyOrderChecks := false; … … 515 520 procedure TfrmOptions.LoadImageSettings; 516 521 begin 517 cbEnableImages.Checked := uTMGOptions.ReadBool('EnableImages', false);518 cboTransMethod.ItemIndex := uTMGOptions.ReadInteger('ImageTransferMethod', 0);522 cbEnableImages.Checked := uTMGOptions.ReadBool('EnableImages',true); 523 cboTransMethod.ItemIndex := uTMGOptions.ReadInteger('ImageTransferMethod',2); 519 524 editDropboxLocation.text := uTMGOptions.ReadString('Dropbox directory',''); 520 525 cbEnableScanning.Checked := uTMGOptions.ReadBool('Scan Enabled',false); 521 526 editScannedLocation.text := uTMGOptions.ReadString('Pol Directory',''); 522 527 edtPolFreq.text := IntToStr(uTMGOptions.ReadInteger('Pol Interval (milliseconds)',0)); 523 524 528 cbEnableScanningClick(self); 525 529 cboTransMethodChange(self); … … 568 572 569 573 uTMGOptions.WriteInteger('ImageTransferMethod',cboTransMethod.itemindex); 574 frmImages.TransferMethod := TImgTransferMethod(cboTransMethod.itemindex); 575 { 570 576 if cboTransMethod.text = 'Dropbox Transfer' then begin 571 577 frmImages.UseDropBox := True; … … 573 579 frmImages.UseDropBox := False; 574 580 end; 575 581 } 576 582 uTMGOptions.WriteString('Dropbox directory',editDropboxLocation.text); 577 583 frmImages.DropBoxDir := editDropboxLocation.text; … … 1018 1024 end; 1019 1025 1020 procedure TfrmOptions.cboTransMethodChange(Sender: TObject); 1021 begin 1022 if cboTransMethod.text = 'Dropbox Transfer' then begin 1023 editDropboxLocation.enabled := true; 1024 bitbtn1.enabled := true; 1025 end else begin 1026 editDropboxLocation.enabled := false; 1027 bitbtn1.enabled := false; 1028 end; 1026 procedure TfrmOptions.cboTransMethodChange(Sender: TObject); 1027 var Show : boolean; 1028 begin 1029 if cboTransMethod.Text = IMAGE_TRANSFER_METHODS[itmDirect] then begin 1030 MessageDlg('Sorry. Direct file access not yet supported.',mtInformation,[mbOK],0); 1031 cboTransMethod.ItemIndex := -1; 1032 end; 1033 if cboTransMethod.ItemIndex < 0 then begin 1034 cboTransMethod.ItemIndex := ord(itmRPC); 1035 cboTransMethod.Text := IMAGE_TRANSFER_METHODS[itmRPC]; 1036 end; 1037 Show := (cboTransMethod.ItemIndex = ord(itmDropbox)); 1038 editDropboxLocation.Visible := Show; 1039 btnBrowseDropBox.Visible := Show; 1040 lblDropBox.Visible := Show; 1029 1041 FdirtyImageSettings := true; 1030 1042 CheckApply; 1031 end; 1032 1033 procedure TfrmOptions.cbEnableImagesClick(Sender: TObject); 1034 begin 1035 FdirtyImageSettings := true; 1036 CheckApply; 1037 end; 1038 1039 procedure TfrmOptions.editDropboxLocationChange(Sender: TObject); 1040 begin 1041 FdirtyImageSettings := true; 1042 CheckApply; 1043 end; 1044 1045 procedure TfrmOptions.cbEnableScanningClick(Sender: TObject); 1046 begin 1047 editScannedLocation.enabled := cbEnableScanning.checked; 1048 bitbtn2.enabled := cbEnableScanning.checked; 1049 edtPolFreq.enabled := cbEnableScanning.checked; 1050 FdirtyImageSettings := true; 1051 CheckApply; 1052 end; 1053 1054 procedure TfrmOptions.editScannedLocationChange(Sender: TObject); 1055 begin 1056 FdirtyImageSettings := true; 1057 CheckApply; 1058 end; 1059 1060 procedure TfrmOptions.edtPolFreqChange(Sender: TObject); 1061 begin 1062 FdirtyImageSettings := true; 1063 CheckApply; 1064 end; 1065 1066 procedure TfrmOptions.BitBtn1Click(Sender: TObject); 1067 var 1068 sFolder: string; 1069 begin 1070 sFolder := BrowseDialog('Choose a Dropbox folder', BIF_RETURNONLYFSDIRS); 1071 if sFolder <> '' then begin 1072 if rightstr(sFolder,1) = '\' then begin 1073 editDropboxLocation.text := sFolder; 1074 end else begin 1075 editDropboxLocation.text := sFolder + '\'; 1076 end; 1077 end; 1078 end; 1079 1080 function TfrmOptions.BrowseDialog(const Title: string; const Flag: integer): string; 1081 var 1082 lpItemID : PItemIDList; 1083 BrowseInfo : TBrowseInfo; 1084 DisplayName : array[0..MAX_PATH] of char; 1085 TempPath : array[0..MAX_PATH] of char; 1086 begin 1087 Result:=''; 1088 FillChar(BrowseInfo, sizeof(TBrowseInfo), #0); 1089 with BrowseInfo do begin 1090 hwndOwner := Application.Handle; 1091 pszDisplayName := @DisplayName; 1092 lpszTitle := PChar(Title); 1093 ulFlags := Flag; 1094 end; 1095 lpItemID := SHBrowseForFolder(BrowseInfo); 1096 if lpItemId <> nil then begin 1097 SHGetPathFromIDList(lpItemID, TempPath); 1098 Result := TempPath; 1099 GlobalFreePtr(lpItemID); 1100 end; 1101 end; 1102 1103 1104 procedure TfrmOptions.BitBtn2Click(Sender: TObject); 1105 var 1106 sFolder: string; 1107 begin 1108 sFolder := BrowseDialog('Choose a Scanned folder', BIF_RETURNONLYFSDIRS); 1109 if sFolder <> '' then begin 1110 if rightstr(sFolder,1) = '\' then begin 1111 editScannedLocation.text := sFolder; 1112 end else begin 1113 editScannedLocation.text := sFolder + '\'; 1114 end; 1115 end; 1116 end; 1043 end; 1044 1045 procedure TfrmOptions.cbEnableImagesClick(Sender: TObject); 1046 begin 1047 FdirtyImageSettings := true; 1048 CheckApply; 1049 end; 1050 1051 procedure TfrmOptions.editDropboxLocationChange(Sender: TObject); 1052 begin 1053 FdirtyImageSettings := true; 1054 CheckApply; 1055 end; 1056 1057 procedure TfrmOptions.cbEnableScanningClick(Sender: TObject); 1058 begin 1059 editScannedLocation.Visible := cbEnableScanning.checked; 1060 btnBrowseScannedImages.Visible := cbEnableScanning.checked; 1061 edtPolFreq.Visible := cbEnableScanning.checked; 1062 lblScannedImagesFolder.Visible := cbEnableScanning.checked; 1063 lblPollingInterval.Visible := cbEnableScanning.checked; 1064 lblSeconds.Visible := cbEnableScanning.checked; 1065 FdirtyImageSettings := true; 1066 CheckApply; 1067 end; 1068 1069 procedure TfrmOptions.editScannedLocationChange(Sender: TObject); 1070 begin 1071 FdirtyImageSettings := true; 1072 CheckApply; 1073 end; 1074 1075 procedure TfrmOptions.edtPolFreqChange(Sender: TObject); 1076 begin 1077 FdirtyImageSettings := true; 1078 CheckApply; 1079 end; 1080 1081 procedure TfrmOptions.btnBrowseDropBoxClick(Sender: TObject); 1082 var 1083 sFolder: string; 1084 begin 1085 sFolder := BrowseDialog('Choose a Dropbox folder', BIF_RETURNONLYFSDIRS); 1086 if sFolder <> '' then begin 1087 if rightstr(sFolder,1) = '\' then begin 1088 editDropboxLocation.text := sFolder; 1089 end else begin 1090 editDropboxLocation.text := sFolder + '\'; 1091 end; 1092 end; 1093 end; 1094 1095 function TfrmOptions.BrowseDialog(const Title: string; const Flag: integer): string; 1096 var 1097 lpItemID : PItemIDList; 1098 BrowseInfo : TBrowseInfo; 1099 DisplayName : array[0..MAX_PATH] of char; 1100 TempPath : array[0..MAX_PATH] of char; 1101 begin 1102 Result:=''; 1103 FillChar(BrowseInfo, sizeof(TBrowseInfo), #0); 1104 with BrowseInfo do begin 1105 hwndOwner := Application.Handle; 1106 pszDisplayName := @DisplayName; 1107 lpszTitle := PChar(Title); 1108 ulFlags := Flag; 1109 end; 1110 lpItemID := SHBrowseForFolder(BrowseInfo); 1111 if lpItemId <> nil then begin 1112 SHGetPathFromIDList(lpItemID, TempPath); 1113 Result := TempPath; 1114 GlobalFreePtr(lpItemID); 1115 end; 1116 end; 1117 1118 procedure TfrmOptions.btnBrowseScannedImagesClick(Sender: TObject); 1119 var 1120 sFolder: string; 1121 begin 1122 sFolder := BrowseDialog('Choose a Scanned folder', BIF_RETURNONLYFSDIRS); 1123 if sFolder <> '' then begin 1124 if rightstr(sFolder,1) = '\' then begin 1125 editScannedLocation.text := sFolder; 1126 end else begin 1127 editScannedLocation.text := sFolder + '\'; 1128 end; 1129 end; 1130 end; 1117 1131 1118 1132 end.
Note:
See TracChangeset
for help on using the changeset viewer.