Source code of file oscpmwin_v0.1.2.436/pedit.pas from the
osCommerce Product Manager for Windows.
0000: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001: osCommerce Product Manager for Windows (oscpmwin).
0002: Copyright �2003,2004,2005 by Mario A. Valdez-Ramirez.
0003:
0004: You can contact Mario A. Valdez-Ramirez
0005: by email at mario@mariovaldez.org or paper mail at
0006: Olmos 809, San Nicolas, NL. 66495, Mexico.
0007:
0008: This program is free software; you can redistribute it and/or modify
0009: it under the terms of the GNU General Public License as published by
0010: the Free Software Foundation; either version 2 of the License, or (at
0011: your option) any later version.
0012:
0013: This program is distributed in the hope that it will be useful, but
0014: WITHOUT ANY WARRANTY; without even the implied warranty of
0015: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0016: General Public License for more details.
0017:
0018: You should have received a copy of the GNU General Public License
0019: along with this program; if not, write to the Free Software
0020: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0021: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0022: unit pedit;
0023:
0024: interface
0025:
0026: uses
0027: Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
0028: Dialogs, ComCtrls, StdCtrls, Buttons, ExtCtrls,
0029: ImgList, Menus, ShellAPI, CheckLst, oscpmdata;
0030:
0031: CONST
0032: OPM_AUTODOWNLOADIMG = WM_USER + 1234;
0033:
0034: type
0035: Topm_Form_PEdit = class(TForm)
0036: opm_BitBtn_PEditOk: TBitBtn;
0037: opm_BitBtn_PEditCancel: TBitBtn;
0038: opm_ImageList_PImg: TImageList;
0039: opm_PageControl_PEdit: TPageControl;
0040: opm_TabSheet_PEditMain: TTabSheet;
0041: opm_TabSheet_PEditDesc: TTabSheet;
0042: opm_ComboBox_PEditCat: TComboBox;
0043: opm_ComboBox_PEditMan: TComboBox;
0044: opm_Edit_PEditModel: TEdit;
0045: opm_Edit_PEditQuantity: TEdit;
0046: opm_Edit_PEditPrice: TEdit;
0047: opm_Edit_PEditSpecial: TEdit;
0048: opm_Edit_PEditWeight: TEdit;
0049: opm_label_PeditWeight: TLabel;
0050: opm_label_PeditSpecial: TLabel;
0051: opm_label_PeditPrice: TLabel;
0052: opm_label_PeditQty: TLabel;
0053: opm_label_PeditModel: TLabel;
0054: opm_label_PeditMan: TLabel;
0055: opm_label_PeditCat: TLabel;
0056: opm_CheckBox_PEditAvailable: TCheckBox;
0057: opm_TabControl_PEdit: TTabControl;
0058: opm_label_PeditName: TLabel;
0059: opm_label_PeditDesc: TLabel;
0060: opm_label_PeditURL: TLabel;
0061: opm_Edit_PEditName: TEdit;
0062: opm_Memo_PEditDescription: TMemo;
0063: opm_Edit_PEditURL: TEdit;
0064: opm_ComboBox_PEditTax: TComboBox;
0065: opm_label_PeditTax: TLabel;
0066: opm_TabSheet_PEditImg: TTabSheet;
0067: opm_BitBtn_PEditStopDown: TBitBtn;
0068: opm_StaticText_PeditImageETA: TStaticText;
0069: opm_StaticText_PeditImageData: TStaticText;
0070: opm_StaticText_PeditImageURL: TStaticText;
0071: opm_BitBtn_PEditDown: TBitBtn;
0072: opm_BitBtn_PEditDeleteImg: TBitBtn;
0073: opm_BitBtn_PEditUploadImg: TBitBtn;
0074: opm_StaticText_PeditCurr1: TStaticText;
0075: opm_StaticText_PeditCurr2: TStaticText;
0076: opm_Label_PeditViewed: TLabel;
0077: opm_StaticText_PeditViewed: TStaticText;
0078: opm_Memo_UploadDEBUG: TMemo;
0079: opm_PopupMenu_UploadDebug: TPopupMenu;
0080: opm_PopMenuItem_HideUploadDebug: TMenuItem;
0081: opm_BitBtn_PEditSelectImg: TBitBtn;
0082: opm_BitBtn_PEditStripHTML: TBitBtn;
0083: opm_DateTimePicker_PEditAvailDate: TDateTimePicker;
0084: opm_label_PeditAvailDate: TLabel;
0085: opm_StaticText_PeditCDate: TStaticText;
0086: opm_StaticText_PeditMDate: TStaticText;
0087: opm_label_PeditCDate: TLabel;
0088: opm_label_PeditMDate: TLabel;
0089: opm_label_PeditPriceTaxed: TLabel;
0090: opm_Edit_PEditPriceTaxed: TEdit;
0091: opm_StaticText_PeditCurr3: TStaticText;
0092: opm_StatusBar_PEdit: TStatusBar;
0093: opm_Edit_PeditImageURL: TEdit;
0094: opm_BitBtn_PEditUnlinkImg: TBitBtn;
0095: opm_ScrollBox_PeditImage: TScrollBox;
0096: opm_Panel_PeditImage0: TPanel;
0097: opm_Image_Pedit0: TImage;
0098: opm_Panel_PeditImage1: TPanel;
0099: opm_Image_Pedit1: TImage;
0100: opm_Panel_PeditImage2: TPanel;
0101: opm_Image_Pedit2: TImage;
0102: opm_Panel_PeditImage3: TPanel;
0103: opm_Image_Pedit3: TImage;
0104: opm_Panel_PeditImage4: TPanel;
0105: opm_Image_Pedit4: TImage;
0106: opm_Panel_PeditImage5: TPanel;
0107: opm_Image_Pedit5: TImage;
0108: opm_Panel_PeditImage6: TPanel;
0109: opm_Image_Pedit6: TImage;
0110: opm_BitBtn_PEditDownAll: TBitBtn;
0111: opm_SpeedButton_ClearImgCache: TSpeedButton;
0112: procedure FormShow(Sender: TObject);
0113: procedure opm_BitBtn_PEditOkClick(Sender: TObject);
0114: procedure FormCreate(Sender: TObject);
0115: procedure opm_BitBtn_PEditDownClick(Sender: TObject);
0116: procedure opm_BitBtn_PEditStopDownClick(Sender: TObject);
0117: procedure opm_BitBtn_PEditDeleteImgClick(Sender: TObject);
0118: procedure opm_BitBtn_PEditUploadImgClick(Sender: TObject);
0119: procedure FormClose(Sender: TObject; var Action: TCloseAction);
0120: procedure opm_BitBtn_PEditSelectImgClick(Sender: TObject);
0121: procedure opm_PopMenuItem_HideUploadDebugClick(Sender: TObject);
0122: procedure opm_TabControl_PEditChange(Sender: TObject);
0123: procedure opm_TabControl_PEditChanging(Sender: TObject; var AllowChange: Boolean);
0124: procedure opm_BitBtn_PEditStripHTMLClick(Sender: TObject);
0125: procedure opm_ComboBox_PEditTaxChange(Sender: TObject);
0126: procedure opm_Edit_PEditPriceChange(Sender: TObject);
0127: procedure opm_Edit_PEditPriceTaxedChange(Sender: TObject);
0128: procedure opm_Edit_PEditPriceTaxedExit(Sender: TObject);
0129: procedure opm_Edit_PEditPriceTaxedEnter(Sender: TObject);
0130: procedure opm_Edit_PEditPriceEnter(Sender: TObject);
0131: procedure opm_Edit_PEditPriceExit(Sender: TObject);
0132: procedure opm_Edit_PeditImageURLExit(Sender: TObject);
0133: procedure opm_BitBtn_PEditUnlinkImgClick(Sender: TObject);
0134: PROCEDURE opm_Control_SetChange (Sender: TObject);
0135: procedure opm_Image_Pedit0Click(Sender: TObject);
0136: procedure opm_Image_Pedit1Click(Sender: TObject);
0137: procedure opm_Image_Pedit2Click(Sender: TObject);
0138: procedure opm_Image_Pedit3Click(Sender: TObject);
0139: procedure opm_Image_Pedit4Click(Sender: TObject);
0140: procedure opm_Image_Pedit5Click(Sender: TObject);
0141: procedure opm_Image_Pedit6Click(Sender: TObject);
0142: procedure opm_Image_Pedit0DblClick(Sender: TObject);
0143: procedure opm_Image_Pedit1DblClick(Sender: TObject);
0144: procedure opm_Image_Pedit2DblClick(Sender: TObject);
0145: procedure opm_Image_Pedit3DblClick(Sender: TObject);
0146: procedure opm_Image_Pedit4DblClick(Sender: TObject);
0147: procedure opm_Image_Pedit5DblClick(Sender: TObject);
0148: procedure opm_Image_Pedit6DblClick(Sender: TObject);
0149: procedure opm_BitBtn_PEditDownAllClick(Sender: TObject);
0150: procedure opm_Image_Pedit0DragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
0151: procedure opm_Image_Pedit0MouseDown(Sender: TObject;
0152: Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
0153: procedure opm_Image_Pedit0DragDrop(Sender, Source: TObject; X,
0154: Y: Integer);
0155: procedure opm_ScrollBox_PeditImageEnter(Sender: TObject);
0156: procedure opm_ScrollBox_PeditImageExit(Sender: TObject);
0157: procedure opm_SpeedButton_ClearImgCacheClick(Sender: TObject);
0158: private
0159: PROCEDURE opm_PRDownload_Image (ImgURL : STRING; ImageIdx : WORD);
0160: PROCEDURE opm_PRSetControls (ImageName : STRING; ImageState : WORD; ClearThumb: BOOLEAN; ImageIdx : WORD);
0161: PROCEDURE opm_PRPrepareUpload (ImageFile, NewName, ImgSubdir : STRING; ImageJPEG : BOOLEAN);
0162: FUNCTION opm_FNCleanURL (ProductURL : STRING) : STRING;
0163: FUNCTION FNopm_GetTax (VAR TaxList : opmT_TaxList; TaxID : LONGINT; SearchBy : INTEGER) : opmR_Tax;
0164: PROCEDURE opm_PRSetModified (IsModified: BOOLEAN);
0165: PROCEDURE opm_PRToggle_ImgSel (ImgSel, LastSel : LONGINT);
0166: procedure opm_AutoDownload (var DownloadMsg: TMessage); message OPM_AUTODOWNLOADIMG;
0167: procedure opm_GetDropFiles (var DropingMsg: TWMDropFiles); message WM_DROPFILES;
0168: procedure opm_InterceptKeys (var KeyPressMsg: TCMDialogKey); message CM_DIALOGKEY;
0169: PROCEDURE opm_PRCenterImage (SelectedPanel : TPanel);
0170: public
0171: ProductModified : BOOLEAN;
0172: end;
0173:
0174: var
0175: opm_Form_PEdit: Topm_Form_PEdit;
0176: opm_PEdit_CanZoom : ARRAY [0..6] OF BOOLEAN;
0177: opm_CurrentImage : ARRAY [0..6] OF STRING;
0178: opm_PEdit_ImageExist : ARRAY [0..6] OF LONGINT;
0179: opm_CurrentImageIdx : LONGINT;
0180: opm_PEdit_CanClose : BOOLEAN;
0181: opm_PEdit_CalcNewTax : BOOLEAN;
0182: opm_PEdit_CalcTaxed : BOOLEAN;
0183: opm_PEdit_CalcUnTaxed : BOOLEAN;
0184: opm_PEdit_CursorPos : opmT_CurPosDescList;
0185: opm_PEdit_ImageData : ARRAY [0..6] OF STRING;
0186: opm_PEdit_ImageETA : ARRAY [0..6] OF STRING;
0187:
0188: implementation
0189:
0190: {$R *.dfm}
0191:
0192: uses gnugettext, main, pimgzoom, balloons, dataman, attention, imageman,
0193: askupload, askuser, regconfig, network, progress, StrUtils;
0194:
0195:
0196:
0197: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0198: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0199: PROCEDURE Topm_Form_PEdit.opm_PRSetControls (ImageName : STRING; ImageState : WORD; ClearThumb: BOOLEAN; ImageIdx : WORD);
0200: BEGIN
0201: CASE ImageIdx OF
0202: 0 : opm_Panel_PeditImage0.Caption := ImageName;
0203: 1 : opm_Panel_PeditImage1.Caption := ImageName;
0204: 2 : opm_Panel_PeditImage2.Caption := ImageName;
0205: 3 : opm_Panel_PeditImage3.Caption := ImageName;
0206: 4 : opm_Panel_PeditImage4.Caption := ImageName;
0207: 5 : opm_Panel_PeditImage5.Caption := ImageName;
0208: 6 : opm_Panel_PeditImage6.Caption := ImageName;
0209: END;
0210: opm_StaticText_PeditImageURL.Caption := ImageName;
0211: opm_Edit_PeditImageURL.Text := ImageName;
0212: IF (ClearThumb = TRUE) THEN
0213: BEGIN
0214: CASE ImageIdx OF
0215: 0 : opm_Image_Pedit0.Picture := NIL;
0216: 1 : opm_Image_Pedit1.Picture := NIL;
0217: 2 : opm_Image_Pedit2.Picture := NIL;
0218: 3 : opm_Image_Pedit3.Picture := NIL;
0219: 4 : opm_Image_Pedit4.Picture := NIL;
0220: 5 : opm_Image_Pedit5.Picture := NIL;
0221: 6 : opm_Image_Pedit6.Picture := NIL;
0222: END;
0223: opm_Form_ImageZoom.opm_Image_ZoomImage.Picture := NIL;
0224: opm_Form_ImageZoom.opm_Image_ZoomImage.Hint := '';
0225: END;
0226: IF (ImageName = '') THEN ImageState := opmC_ImageIsEmpty;
0227: opm_PEdit_ImageExist[ImageIdx] := ImageState;
0228: opm_StaticText_PeditImageData.Caption := opm_PEdit_ImageData[ImageIdx];
0229: opm_StaticText_PeditImageETA.Caption := opm_PEdit_ImageETA[ImageIdx];
0230: CASE ImageState OF
0231: opmC_ImageDontExist :
0232: BEGIN
0233: opm_PEdit_CanZoom[ImageIdx] := FALSE;
0234: CASE ImageIdx OF
0235: 0 : BEGIN
0236: opm_ImageList_PImg.GetBitmap (2, opm_Image_Pedit0.Picture.Bitmap);
0237: opm_Image_Pedit0.Cursor := crDefault;
0238: opm_Image_Pedit0.Hint := '';
0239: END;
0240: 1 : BEGIN
0241: opm_ImageList_PImg.GetBitmap (2, opm_Image_Pedit1.Picture.Bitmap);
0242: opm_Image_Pedit1.Cursor := crDefault;
0243: opm_Image_Pedit1.Hint := '';
0244: END;
0245: 2 : BEGIN
0246: opm_ImageList_PImg.GetBitmap (2, opm_Image_Pedit2.Picture.Bitmap);
0247: opm_Image_Pedit2.Cursor := crDefault;
0248: opm_Image_Pedit2.Hint := '';
0249: END;
0250: 3 : BEGIN
0251: opm_ImageList_PImg.GetBitmap (2, opm_Image_Pedit3.Picture.Bitmap);
0252: opm_Image_Pedit3.Cursor := crDefault;
0253: opm_Image_Pedit3.Hint := '';
0254: END;
0255: 4 : BEGIN
0256: opm_ImageList_PImg.GetBitmap (2, opm_Image_Pedit4.Picture.Bitmap);
0257: opm_Image_Pedit4.Cursor := crDefault;
0258: opm_Image_Pedit4.Hint := '';
0259: END;
0260: 5 : BEGIN
0261: opm_ImageList_PImg.GetBitmap (2, opm_Image_Pedit5.Picture.Bitmap);
0262: opm_Image_Pedit5.Cursor := crDefault;
0263: opm_Image_Pedit5.Hint := '';
0264: END;
0265: 6 : BEGIN
0266: opm_ImageList_PImg.GetBitmap (2, opm_Image_Pedit6.Picture.Bitmap);
0267: opm_Image_Pedit6.Cursor := crDefault;
0268: opm_Image_Pedit6.Hint := '';
0269: END;
0270: END;
0271: opm_BitBtn_PEditDown.Enabled := TRUE;
0272: opm_BitBtn_PEditDeleteImg.Enabled := TRUE;
0273: opm_BitBtn_PEditUnlinkImg.Enabled := TRUE;
0274: opm_BitBtn_PEditUploadImg.Enabled := FALSE;
0275: opm_BitBtn_PEditSelectImg.Enabled := FALSE;
0276: END;
0277: opmC_ImageMayExist :
0278: BEGIN
0279: opm_PEdit_CanZoom[ImageIdx] := FALSE;
0280: CASE ImageIdx OF
0281: 0 : opm_Image_Pedit0.Cursor := crDefault;
0282: 1 : opm_Image_Pedit1.Cursor := crDefault;
0283: 2 : opm_Image_Pedit2.Cursor := crDefault;
0284: 3 : opm_Image_Pedit3.Cursor := crDefault;
0285: 4 : opm_Image_Pedit4.Cursor := crDefault;
0286: 5 : opm_Image_Pedit5.Cursor := crDefault;
0287: 6 : opm_Image_Pedit6.Cursor := crDefault;
0288: END;
0289: opm_BitBtn_PEditDown.Enabled := TRUE;
0290: opm_BitBtn_PEditDeleteImg.Enabled := TRUE;
0291: opm_BitBtn_PEditUnlinkImg.Enabled := TRUE;
0292: opm_BitBtn_PEditUploadImg.Enabled := FALSE;
0293: opm_BitBtn_PEditSelectImg.Enabled := FALSE;
0294: END;
0295: opmC_ImageExists :
0296: BEGIN
0297: opm_PEdit_CanZoom[ImageIdx] := TRUE;
0298: CASE ImageIdx OF
0299: 0 : opm_Image_Pedit0.Cursor := crHandPoint;
0300: 1 : opm_Image_Pedit1.Cursor := crHandPoint;
0301: 2 : opm_Image_Pedit2.Cursor := crHandPoint;
0302: 3 : opm_Image_Pedit3.Cursor := crHandPoint;
0303: 4 : opm_Image_Pedit4.Cursor := crHandPoint;
0304: 5 : opm_Image_Pedit5.Cursor := crHandPoint;
0305: 6 : opm_Image_Pedit6.Cursor := crHandPoint;
0306: END;
0307: opm_BitBtn_PEditDown.Enabled := TRUE;
0308: opm_BitBtn_PEditDeleteImg.Enabled := TRUE;
0309: opm_BitBtn_PEditUnlinkImg.Enabled := TRUE;
0310: opm_BitBtn_PEditUploadImg.Enabled := FALSE;
0311: opm_BitBtn_PEditSelectImg.Enabled := FALSE;
0312: END;
0313: opmC_ImageIsEmpty :
0314: BEGIN
0315: opm_PEdit_CanZoom[ImageIdx] := FALSE;
0316: CASE ImageIdx OF
0317: 0 : BEGIN
0318: opm_ImageList_PImg.GetBitmap (0, opm_Image_Pedit0.Picture.Bitmap);
0319: opm_Image_Pedit0.Cursor := crDefault;
0320: opm_Image_Pedit0.Hint := '';
0321: END;
0322: 1 : BEGIN
0323: opm_ImageList_PImg.GetBitmap (0, opm_Image_Pedit1.Picture.Bitmap);
0324: opm_Image_Pedit1.Cursor := crDefault;
0325: opm_Image_Pedit1.Hint := '';
0326: END;
0327: 2 : BEGIN
0328: opm_ImageList_PImg.GetBitmap (0, opm_Image_Pedit2.Picture.Bitmap);
0329: opm_Image_Pedit2.Cursor := crDefault;
0330: opm_Image_Pedit2.Hint := '';
0331: END;
0332: 3 : BEGIN
0333: opm_ImageList_PImg.GetBitmap (0, opm_Image_Pedit3.Picture.Bitmap);
0334: opm_Image_Pedit3.Cursor := crDefault;
0335: opm_Image_Pedit3.Hint := '';
0336: END;
0337: 4 : BEGIN
0338: opm_ImageList_PImg.GetBitmap (0, opm_Image_Pedit4.Picture.Bitmap);
0339: opm_Image_Pedit4.Cursor := crDefault;
0340: opm_Image_Pedit4.Hint := '';
0341: END;
0342: 5 : BEGIN
0343: opm_ImageList_PImg.GetBitmap (0, opm_Image_Pedit5.Picture.Bitmap);
0344: opm_Image_Pedit5.Cursor := crDefault;
0345: opm_Image_Pedit5.Hint := '';
0346: END;
0347: 6 : BEGIN
0348: opm_ImageList_PImg.GetBitmap (0, opm_Image_Pedit6.Picture.Bitmap);
0349: opm_Image_Pedit6.Cursor := crDefault;
0350: opm_Image_Pedit6.Hint := '';
0351: END;
0352: END;
0353: opm_BitBtn_PEditDown.Enabled := FALSE;
0354: opm_BitBtn_PEditDeleteImg.Enabled := FALSE;
0355: opm_BitBtn_PEditUnlinkImg.Enabled := FALSE;
0356: opm_BitBtn_PEditUploadImg.Enabled := TRUE;
0357: opm_BitBtn_PEditSelectImg.Enabled := TRUE;
0358: END;
0359: opmC_ImageIsCorrupt :
0360: BEGIN
0361: opm_PEdit_CanZoom[ImageIdx] := FALSE;
0362: CASE ImageIdx OF
0363: 0 : BEGIN
0364: opm_ImageList_PImg.GetBitmap (1, opm_Image_Pedit0.Picture.Bitmap);
0365: opm_Image_Pedit0.Cursor := crDefault;
0366: opm_Image_Pedit0.Hint := '';
0367: END;
0368: 1 : BEGIN
0369: opm_ImageList_PImg.GetBitmap (1, opm_Image_Pedit1.Picture.Bitmap);
0370: opm_Image_Pedit1.Cursor := crDefault;
0371: opm_Image_Pedit1.Hint := '';
0372: END;
0373: 2 : BEGIN
0374: opm_ImageList_PImg.GetBitmap (1, opm_Image_Pedit2.Picture.Bitmap);
0375: opm_Image_Pedit2.Cursor := crDefault;
0376: opm_Image_Pedit2.Hint := '';
0377: END;
0378: 3 : BEGIN
0379: opm_ImageList_PImg.GetBitmap (1, opm_Image_Pedit3.Picture.Bitmap);
0380: opm_Image_Pedit3.Cursor := crDefault;
0381: opm_Image_Pedit3.Hint := '';
0382: END;
0383: 4 : BEGIN
0384: opm_ImageList_PImg.GetBitmap (1, opm_Image_Pedit4.Picture.Bitmap);
0385: opm_Image_Pedit4.Cursor := crDefault;
0386: opm_Image_Pedit4.Hint := '';
0387: END;
0388: 5 : BEGIN
0389: opm_ImageList_PImg.GetBitmap (1, opm_Image_Pedit5.Picture.Bitmap);
0390: opm_Image_Pedit5.Cursor := crDefault;
0391: opm_Image_Pedit5.Hint := '';
0392: END;
0393: 6 : BEGIN
0394: opm_ImageList_PImg.GetBitmap (1, opm_Image_Pedit6.Picture.Bitmap);
0395: opm_Image_Pedit6.Cursor := crDefault;
0396: opm_Image_Pedit6.Hint := '';
0397: END;
0398: END;
0399: opm_BitBtn_PEditDown.Enabled := TRUE;
0400: opm_BitBtn_PEditDeleteImg.Enabled := TRUE;
0401: opm_BitBtn_PEditUnlinkImg.Enabled := TRUE;
0402: opm_BitBtn_PEditUploadImg.Enabled := FALSE;
0403: opm_BitBtn_PEditSelectImg.Enabled := FALSE;
0404: END;
0405: opmC_ImageIsBeingProcessed :
0406: BEGIN
0407: opm_PEdit_CanZoom[ImageIdx] := FALSE;
0408: CASE ImageIdx OF
0409: 0 : opm_Image_Pedit0.Cursor := crDefault;
0410: 1 : opm_Image_Pedit1.Cursor := crDefault;
0411: 2 : opm_Image_Pedit2.Cursor := crDefault;
0412: 3 : opm_Image_Pedit3.Cursor := crDefault;
0413: 4 : opm_Image_Pedit4.Cursor := crDefault;
0414: 5 : opm_Image_Pedit5.Cursor := crDefault;
0415: 6 : opm_Image_Pedit6.Cursor := crDefault;
0416: END;
0417: opm_BitBtn_PEditDown.Enabled := FALSE;
0418: opm_BitBtn_PEditDeleteImg.Enabled := FALSE;
0419: opm_BitBtn_PEditUnlinkImg.Enabled := FALSE;
0420: opm_BitBtn_PEditUploadImg.Enabled := FALSE;
0421: opm_BitBtn_PEditSelectImg.Enabled := FALSE;
0422: END;
0423: END;
0424: IF (opmG_WBUploadURL = '') THEN
0425: BEGIN
0426: opm_BitBtn_PEditDeleteImg.Enabled := FALSE;
0427: opm_BitBtn_PEditUploadImg.Enabled := FALSE;
0428: opm_BitBtn_PEditSelectImg.Enabled := FALSE;
0429: END;
0430: END;
0431:
0432:
0433: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0434: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0435: PROCEDURE Topm_Form_PEdit.opm_PRToggle_ImgSel (ImgSel, LastSel : LONGINT);
0436: BEGIN
0437: {=========================================
0438: NOTE: Why not use FindComponent?
0439: These "CASE x OF 1,2,3,4,5,6" statements look ugly but are fast.
0440: FindComponent looks cool but is very slow.
0441: Too slow for interactive use.
0442: ==========================================}
0443: IF (opmG_Capa_MorePics6 = TRUE) THEN
0444: BEGIN
0445: CASE LastSel OF
0446: 0 : opm_Panel_PeditImage0.Color := clBtnFace;
0447: 1 : opm_Panel_PeditImage1.Color := clBtnFace;
0448: 2 : opm_Panel_PeditImage2.Color := clBtnFace;
0449: 3 : opm_Panel_PeditImage3.Color := clBtnFace;
0450: 4 : opm_Panel_PeditImage4.Color := clBtnFace;
0451: 5 : opm_Panel_PeditImage5.Color := clBtnFace;
0452: 6 : opm_Panel_PeditImage6.Color := clBtnFace;
0453: END;
0454: CASE ImgSel OF
0455: 0 : opm_Panel_PeditImage0.Color := clBtnHighlight;
0456: 1 : opm_Panel_PeditImage1.Color := clBtnHighlight;
0457: 2 : opm_Panel_PeditImage2.Color := clBtnHighlight;
0458: 3 : opm_Panel_PeditImage3.Color := clBtnHighlight;
0459: 4 : opm_Panel_PeditImage4.Color := clBtnHighlight;
0460: 5 : opm_Panel_PeditImage5.Color := clBtnHighlight;
0461: 6 : opm_Panel_PeditImage6.Color := clBtnHighlight;
0462: END;
0463: END;
0464: END;
0465:
0466:
0467:
0468: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0469: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0470: procedure Topm_Form_PEdit.FormShow(Sender: TObject);
0471: VAR
0472: CurLang : LONGINT;
0473: DisplayTabIndex : LONGINT;
0474: CurCat : opmR_Category;
0475: CurImg : LONGINT;
0476: begin
0477: opm_PEdit_CalcNewTax := FALSE;
0478: opm_PEdit_CalcTaxed := FALSE;
0479: opm_PEdit_CalcUnTaxed := FALSE;
0480: opm_Form_PEdit.Caption := opm_CurrentProdRecord.DisplayName;
0481: opm_Edit_PEditModel.Text := opm_CurrentProdRecord.Model;
0482: opm_ComboBox_PEditMan.Items := opmG_ManufacturerBoxList;
0483: opm_ComboBox_PEditTax.Items := opmG_TaxBoxList;
0484: opm_CurrentManRecord := opm_Form_Main.FNopm_GetManufacturer (opmG_ManufacturerList, opm_CurrentProdRecord.ManufacturerID, opmC_FindByID);
0485: opm_ComboBox_PEditMan.ItemIndex := opm_CurrentManRecord.ListIndex;
0486: opm_CurrentTaxRecord := FNopm_GetTax (opmG_TaxList, opm_CurrentProdRecord.Tax, opmC_FindByID);
0487: opm_ComboBox_PEditTax.ItemIndex := opm_CurrentTaxRecord.ListIndex;
0488: opm_ComboBox_PEditCat.Items := opmG_CategoryBoxList;
0489: CurCat := opm_Form_Main.FNopm_GetCategory (opmG_CategoryList, opm_CurrentProdRecord.CategoryID, opmC_FindByID);
0490: opm_ComboBox_PEditCat.ItemIndex := CurCat.ListIndex;
0491: opm_Edit_PEditQuantity.Text := INTTOSTR (opm_CurrentProdRecord.Quantity);
0492: opm_Edit_PEditPrice.Text := CURRTOSTR (opm_CurrentProdRecord.Price);
0493: opm_Edit_PEditPriceTaxed.Text := FNopm_AfterTaxPrice (opm_Edit_PEditPrice.Text, opm_CurrentTaxRecord.SumRate);
0494: opm_Edit_PEditSpecial.Text := CURRTOSTR (opm_CurrentProdRecord.Special);
0495: opm_Edit_PEditWeight.Text := CURRTOSTR (opm_CurrentProdRecord.Weight);
0496: IF (opmG_UIAutoDownImg = 0) THEN opm_PageControl_PEdit.ActivePageIndex := 0 ELSE opm_PageControl_PEdit.ActivePageIndex := (opm_PageControl_PEdit.PageCount - 1);
0497: opm_TabControl_PEdit.Tabs.Clear;
0498: opm_TabControl_PEdit.Tabs := opmG_LanguageBoxList;
0499: DisplayTabIndex := opmC_Def_DisplayLang;
0500: FOR CurLang := 0 TO (opm_TotalLanguages - 1) DO
0501: IF (opm_CurrentLang = opmG_LanguageList[CurLang].ID) THEN DisplayTabIndex := CurLang;
0502: opm_TabControl_PEdit.TabIndex := DisplayTabIndex;
0503: IF (opm_CurrentProdRecord.Available > 0) THEN opm_CheckBox_PEditAvailable.Checked := TRUE ELSE opm_CheckBox_PEditAvailable.Checked := FALSE;
0504: opm_StaticText_PeditCDate.Caption := FNopm_DateToString (opm_CurrentProdRecord.CreationDate);
0505: opm_StaticText_PeditMDate.Caption := FNopm_DateToString (opm_CurrentProdRecord.ChangeDate);
0506: opm_DateTimePicker_PEditAvailDate.DateTime := opm_CurrentProdRecord.AvailDate;
0507: opm_StaticText_PeditCurr1.Caption := opm_CurrentCurrency.Code + ' ' + opm_CurrentCurrency.Left + ' ' + opm_CurrentCurrency.Right;
0508: opm_StaticText_PeditCurr2.Caption := opm_CurrentCurrency.Code + ' ' + opm_CurrentCurrency.Left + ' ' + opm_CurrentCurrency.Right;
0509: opm_StaticText_PeditCurr3.Caption := opm_CurrentCurrency.Code + ' ' + opm_CurrentCurrency.Left + ' ' + opm_CurrentCurrency.Right;
0510: opm_Edit_PEditName.Text := opm_CurrentSingleDescList[DisplayTabIndex].Name;
0511: opm_Edit_PEditURL.Text := opm_FNCleanURL (opm_CurrentSingleDescList[DisplayTabIndex].URL);
0512: opm_StaticText_PeditViewed.Caption := INTTOSTR (opm_CurrentSingleDescList[DisplayTabIndex].Viewed);
0513: opm_Memo_PEditDescription.Lines.Text := opm_CurrentSingleDescList[DisplayTabIndex].Description;
0514: opm_Memo_PEditDescription.SelStart := 0;
0515: FOR DisplayTabIndex := 0 TO opmC_Max_Languages_PerList DO
0516: opm_PEdit_CursorPos[DisplayTabIndex] := 0;
0517: opm_BitBtn_PEditStopDown.Visible := FALSE;
0518: opm_BitBtn_PEditStopDown.Enabled := FALSE;
0519: opm_StaticText_PeditImageURL.Visible := NOT (opmG_UIAllowEditImageName > 0);
0520: opm_StaticText_PeditImageURL.Enabled := NOT (opmG_UIAllowEditImageName > 0);
0521: opm_SpeedButton_ClearImgCache.Visible := (opmG_UICacheIList > 0);
0522: opm_SpeedButton_ClearImgCache.Enabled := (opmG_UICacheIList > 0);
0523: opm_Edit_PeditImageURL.Visible := (opmG_UIAllowEditImageName > 0);
0524: opm_Edit_PeditImageURL.Enabled := (opmG_UIAllowEditImageName > 0);
0525: opm_BitBtn_PEditDownAll.Visible := opmG_Capa_MorePics6;
0526: opm_BitBtn_PEditDownAll.Enabled := opmG_Capa_MorePics6;
0527: opm_Memo_UploadDEBUG.Clear;
0528: opm_CurrentImage[0] := opm_CurrentProdRecord.ImageURL;
0529: opm_CurrentImage[1] := opm_CurrentProdRecord.ImageURL1;
0530: opm_CurrentImage[2] := opm_CurrentProdRecord.ImageURL2;
0531: opm_CurrentImage[3] := opm_CurrentProdRecord.ImageURL3;
0532: opm_CurrentImage[4] := opm_CurrentProdRecord.ImageURL4;
0533: opm_CurrentImage[5] := opm_CurrentProdRecord.ImageURL5;
0534: opm_CurrentImage[6] := opm_CurrentProdRecord.ImageURL6;
0535: opm_ScrollBox_PeditImage.HorzScrollBar.Position := 0;
0536: opm_ScrollBox_PeditImage.VertScrollBar.Position := 0;
0537: opm_Panel_PeditImage1.Visible := opmG_Capa_MorePics6;
0538: opm_Panel_PeditImage2.Visible := opmG_Capa_MorePics6;
0539: opm_Panel_PeditImage3.Visible := opmG_Capa_MorePics6;
0540: opm_Panel_PeditImage4.Visible := opmG_Capa_MorePics6;
0541: opm_Panel_PeditImage5.Visible := opmG_Capa_MorePics6;
0542: opm_Panel_PeditImage6.Visible := opmG_Capa_MorePics6;
0543: FOR CurImg := 6 DOWNTO 0 DO
0544: BEGIN
0545: opm_PEdit_ImageData[CurImg] := '';
0546: opm_PEdit_ImageETA[CurImg] := '';
0547: opm_PRSetControls (opm_CurrentImage[CurImg], opmC_ImageMayExist, TRUE, CurImg);
0548: opm_PRToggle_ImgSel (-1, CurImg);
0549: END;
0550: opm_CurrentImageIdx := 0;
0551: opm_PRToggle_ImgSel (opm_CurrentImageIdx, -1);
0552: opm_PRSetModified (FALSE);
0553: opm_PEdit_CanClose := TRUE;
0554: PRopm_Prepare_HTTPClient (opm_Form_Progress.opm_ProgressBar_Progress2, opm_Form_Progress.opm_Label_ProgressMsg2, ((opmG_UseProxy > 0) AND (opmG_ProxyApply IN [0, 1])));
0555: DragAcceptFiles (Handle, (opmG_UIImgDragDrop > 0));
0556: opm_PEdit_CalcNewTax := TRUE;
0557: IF (opmG_UIAutoDownImg > 0) THEN PostMessage (Handle, OPM_AUTODOWNLOADIMG, 0, LONGINT (Sender));
0558: end;
0559:
0560:
0561: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0562: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0563: procedure Topm_Form_PEdit.opm_BitBtn_PEditOkClick(Sender: TObject);
0564: VAR
0565: CurMan : opmR_Manufacturer;
0566: CurCat : opmR_Category;
0567: CurTax : opmR_Tax;
0568: CurLang : LONGINT;
0569: begin
0570: opm_CurrentPEditRecord.ID := opm_CurrentProdRecord.ID;
0571: opm_CurrentPEditRecord.Model := FNopm_CleanString (opm_Edit_PEditModel.Text);
0572: opm_CurrentPEditRecord.Quantity := FNopm_StrToInt (opm_Edit_PEditQuantity.Text);
0573: CurMan := opm_Form_Main.FNopm_GetManufacturer (opmG_ManufacturerList, opm_ComboBox_PEditMan.ItemIndex, opmC_FindByIndex);
0574: opm_CurrentPEditRecord.ManufacturerID := CurMan.ID;
0575: CurTax := FNopm_GetTax (opmG_TaxList, opm_ComboBox_PEditTax.ItemIndex, opmC_FindByIndex);
0576: opm_CurrentPEditRecord.Tax := CurTax.ID;
0577: CurCat := opm_Form_Main.FNopm_GetCategory (opmG_CategoryList, opm_ComboBox_PEditCat.ItemIndex, opmC_FindByIndex);
0578: opm_CurrentPEditRecord.CategoryID := CurCat.ID;
0579: opm_CurrentPEditRecord.Price := ABS (STRTOCURR (FNopm_CleanNumber (opm_Edit_PEditPrice.Text, opmC_ValIsCurrency)));
0580: opm_CurrentPEditRecord.Special := ABS (STRTOCURR (FNopm_CleanNumber (opm_Edit_PEditSpecial.Text, opmC_ValIsCurrency)));
0581: opm_CurrentPEditRecord.Weight := ABS (STRTOCURR (FNopm_CleanNumber (opm_Edit_PEditWeight.Text, opmC_ValIsCurrency)));
0582: opm_CurrentPEditRecord.DisplayName := FNopm_CleanString (opm_Edit_PEditName.Text);
0583: opm_CurrentPEditRecord.ImageURL := opm_CurrentImage[0];
0584: opm_CurrentPEditRecord.ImageURL1 := opm_CurrentImage[1];
0585: opm_CurrentPEditRecord.ImageURL2 := opm_CurrentImage[2];
0586: opm_CurrentPEditRecord.ImageURL3 := opm_CurrentImage[3];
0587: opm_CurrentPEditRecord.ImageURL4 := opm_CurrentImage[4];
0588: opm_CurrentPEditRecord.ImageURL5 := opm_CurrentImage[5];
0589: opm_CurrentPEditRecord.ImageURL6 := opm_CurrentImage[6];
0590: opm_CurrentPEditRecord.LanguageID := opm_CurrentLang;
0591: opm_CurrentPEditRecord.AvailDate := opm_DateTimePicker_PEditAvailDate.DateTime;
0592: IF (opm_CheckBox_PEditAvailable.Checked = TRUE) THEN opm_CurrentPEditRecord.Available := 1 ELSE opm_CurrentPEditRecord.Available := 0;
0593: opm_CurrentSingleDescList[opm_TabControl_PEdit.TabIndex].Name := FNopm_CleanString (opm_Edit_PEditName.Text);
0594: opm_CurrentSingleDescList[opm_TabControl_PEdit.TabIndex].URL := opm_FNCleanURL (opm_Edit_PEditURL.Text);
0595: opm_CurrentSingleDescList[opm_TabControl_PEdit.TabIndex].Description := FNopm_CleanString (opm_Memo_PEditDescription.Lines.Text);
0596: FOR CurLang := 0 TO (opm_TotalLanguages - 1) DO
0597: IF (opm_CurrentSingleDescList[CurLang].ID > 0) THEN
0598: BEGIN
0599: IF (opm_CurrentSingleDescList[CurLang].Name = '') THEN
0600: BEGIN
0601: opm_PageControl_PEdit.ActivePageIndex := 1;
0602: opm_Form_PEdit.FocusControl (opm_Edit_PEditName);
0603: FNopm_Message (_('The name of the product is missing.'), mtWarning, [mbOk], opmG_UISilent);
0604: ModalResult := mrNone;
0605: BREAK;
0606: END;
0607: END;
0608: IF ((opm_CurrentPEditRecord.Quantity < 0) AND (opmG_UIAllowNegativeQuantity = 0)) THEN
0609: BEGIN
0610: opm_PageControl_PEdit.ActivePageIndex := 0;
0611: opm_Form_PEdit.FocusControl (opm_Edit_PEditQuantity);
0612: FNopm_Message (_('The quantity of the product cannot be negative.'), mtWarning, [mbOk], opmG_UISilent);
0613: ModalResult := mrNone;
0614: END
0615: ELSE IF (opm_CurrentPEditRecord.Price < 0) OR ((opm_CurrentPEditRecord.Price = 0) AND (opmG_UIAllowZeroPrice = 0)) THEN
0616: BEGIN
0617: opm_PageControl_PEdit.ActivePageIndex := 0;
0618: opm_Form_PEdit.FocusControl (opm_Edit_PEditPrice);
0619: FNopm_Message (_('The price of the product is missing.'), mtWarning, [mbOk], opmG_UISilent);
0620: ModalResult := mrNone;
0621: END;
0622: opm_PEdit_CanClose := TRUE;
0623: END;
0624:
0625: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0626: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0627: procedure Topm_Form_PEdit.FormCreate(Sender: TObject);
0628: begin
0629: opm_Form_PEdit.Constraints.MinWidth := opmC_MinPWindow_XSize;
0630: opm_Form_PEdit.Constraints.MinHeight := opmC_MinPWindow_YSize;
0631: opm_Form_PEdit.Constraints.MaxWidth := opmC_MaxPWindow_XSize;
0632: opm_Form_PEdit.Constraints.MaxHeight := opmC_MaxPWindow_YSize;
0633: opm_Form_PEdit.Width := opmC_DefPWindow_XSize;
0634: opm_Form_PEdit.Height := opmC_DefPWindow_YSize;
0635: opm_Edit_PEditModel.MaxLength := opmC_ProdModel_MaxLen;
0636: opm_Edit_PEditPrice.MaxLength := opmC_ProdPrice_MaxLen;
0637: opm_Edit_PEditSpecial.MaxLength := opmC_ProdSpecial_MaxLen;
0638: opm_Edit_PEditWeight.MaxLength := opmC_ProdWeight_MaxLen;
0639: opm_Edit_PEditQuantity.MaxLength := opmC_ProdQuantity_MaxLen;
0640: opm_Edit_PEditURL.MaxLength := opmC_ProdURL_MaxLen;
0641: opm_Edit_PEditName.MaxLength := opmC_ProdName_MaxLen;
0642: opm_Memo_PEditDescription.MaxLength := opmC_ProdDescription_MaxLen;
0643: opm_DateTimePicker_PEditAvailDate.Date := opmC_Def_PDate;
0644: opm_DateTimePicker_PEditAvailDate.MaxDate := opmC_Max_PDate;
0645: opm_DateTimePicker_PEditAvailDate.MinDate := opmC_Min_PDate;
0646: opm_DateTimePicker_PEditAvailDate.Format := opmC_PDate_Format;
0647: opm_Panel_PeditImage0.DoubleBuffered := TRUE;
0648: opm_Panel_PeditImage1.DoubleBuffered := TRUE;
0649: opm_Panel_PeditImage2.DoubleBuffered := TRUE;
0650: opm_Panel_PeditImage3.DoubleBuffered := TRUE;
0651: opm_Panel_PeditImage4.DoubleBuffered := TRUE;
0652: opm_Panel_PeditImage5.DoubleBuffered := TRUE;
0653: opm_Panel_PeditImage6.DoubleBuffered := TRUE;
0654: opm_PEdit_CanClose := TRUE;
0655: ProductModified := FALSE;
0656: IF (opmG_UIHotTracking > 0) THEN
0657: BEGIN
0658: opm_TabControl_PEdit.HotTrack := TRUE;
0659: opm_PageControl_PEdit.HotTrack := TRUE;
0660: END
0661: ELSE
0662: BEGIN
0663: opm_TabControl_PEdit.HotTrack := FALSE;
0664: opm_PageControl_PEdit.HotTrack := FALSE;
0665: END;
0666: IF (opmG_UIWBDebug > 0) THEN
0667: BEGIN
0668: opm_Memo_UploadDEBUG.Enabled := TRUE;
0669: opm_Memo_UploadDEBUG.Visible := TRUE;
0670: END
0671: ELSE
0672: BEGIN
0673: opm_Memo_UploadDEBUG.Enabled := FALSE;
0674: opm_Memo_UploadDEBUG.Visible := FALSE;
0675: opm_Memo_UploadDEBUG.Clear;
0676: END;
0677: TranslateComponent (self);
0678: end;
0679:
0680: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0681: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0682: procedure Topm_Form_PEdit.opm_BitBtn_PEditDownClick (Sender: TObject);
0683: BEGIN
0684: opm_PRSetControls (opm_CurrentImage[opm_CurrentImageIdx], opmC_ImageMayExist, TRUE, opm_CurrentImageIdx);
0685: IF (opm_CurrentImage[opm_CurrentImageIdx] <> '') THEN
0686: BEGIN
0687: opm_BitBtn_PEditDown.Enabled := FALSE;
0688: opm_BitBtn_PEditStopDown.Visible := TRUE;
0689: opm_BitBtn_PEditStopDown.Enabled := TRUE;
0690: opm_PRDownload_Image (opm_CurrentImage[opm_CurrentImageIdx], opm_CurrentImageIdx);
0691: opm_BitBtn_PEditDown.Enabled := TRUE;
0692: opm_BitBtn_PEditStopDown.Visible := FALSE;
0693: opm_BitBtn_PEditStopDown.Enabled := FALSE;
0694: END;
0695: end;
0696:
0697:
0698: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0699: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0700: procedure Topm_Form_PEdit.opm_BitBtn_PEditStopDownClick(Sender: TObject);
0701: begin
0702: PRopm_Disconnect_HTTPClient;
0703: end;
0704:
0705:
0706: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0707: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0708: procedure Topm_Form_PEdit.opm_AutoDownload (var DownloadMsg: TMessage);
0709: VAR
0710: AvailImg : BOOLEAN;
0711: CurImg : LONGINT;
0712: begin
0713: AvailImg := FALSE;
0714: FOR CurImg := 0 TO 6 DO
0715: IF (opm_CurrentImage[CurImg] <> '') THEN AvailImg := TRUE;
0716: IF (AvailImg = TRUE) THEN
0717: BEGIN
0718: opm_BitBtn_PEditDown.Enabled := FALSE;
0719: opm_BitBtn_PEditStopDown.Visible := TRUE;
0720: opm_BitBtn_PEditStopDown.Enabled := TRUE;
0721: FOR CurImg := 0 TO 6 DO
0722: BEGIN
0723: opm_PRSetControls (opm_CurrentImage[CurImg], opmC_ImageMayExist, TRUE, CurImg);
0724: IF (opm_CurrentImage[CurImg] <> '') THEN
0725: BEGIN
0726: opm_PRDownload_Image (opm_CurrentImage[CurImg], CurImg);
0727: END;
0728: END;
0729: opm_BitBtn_PEditDown.Enabled := TRUE;
0730: opm_BitBtn_PEditStopDown.Visible := FALSE;
0731: opm_BitBtn_PEditStopDown.Enabled := FALSE;
0732: opm_PRToggle_ImgSel (0, opm_CurrentImageIdx);
0733: opm_CurrentImageIdx := 0;
0734: opm_PRSetControls (opm_CurrentImage[opm_CurrentImageIdx], opm_PEdit_ImageExist[opm_CurrentImageIdx], FALSE, opm_CurrentImageIdx);
0735: END;
0736: end;
0737:
0738:
0739: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0740: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0741: PROCEDURE Topm_Form_PEdit.opm_PRDownload_Image (ImgURL : STRING; ImageIdx : WORD);
0742: VAR
0743: FileStream : TFileStream;
0744: ImgFileSize : LONGINT;
0745: BEGIN
0746: opm_Form_Progress.PRopm_PDShow (FALSE, TRUE);
0747: opm_Form_Progress.PRopm_PDUpdate_Progress (30, 1, _('Downloading image...'));
0748: IF (FNopm_Download_File (opmG_WBImgURL + ImgURL, opmG_TMPPath + opmC_TmpImg_Filename) = TRUE) THEN
0749: TRY
0750: opm_Form_Progress.PRopm_PDUpdate_Progress (60, 1, _('Converting image...'));
0751: IF (FNopm_ConvertImage2 (opmG_TMPPath + opmC_TmpImg_Filename, opmG_TMPPath + opmC_TmpBMP_Filename, opmC_BMPFormat, 0, '') = TRUE) THEN
0752: BEGIN
0753: CASE ImageIdx OF
0754: 0 : opm_Image_Pedit0.Picture.LoadFromFile (opmG_TMPPath + opmC_TmpBMP_Filename);
0755: 1 : opm_Image_Pedit1.Picture.LoadFromFile (opmG_TMPPath + opmC_TmpBMP_Filename);
0756: 2 : opm_Image_Pedit2.Picture.LoadFromFile (opmG_TMPPath + opmC_TmpBMP_Filename);
0757: 3 : opm_Image_Pedit3.Picture.LoadFromFile (opmG_TMPPath + opmC_TmpBMP_Filename);
0758: 4 : opm_Image_Pedit4.Picture.LoadFromFile (opmG_TMPPath + opmC_TmpBMP_Filename);
0759: 5 : opm_Image_Pedit5.Picture.LoadFromFile (opmG_TMPPath + opmC_TmpBMP_Filename);
0760: 6 : opm_Image_Pedit6.Picture.LoadFromFile (opmG_TMPPath + opmC_TmpBMP_Filename);
0761: END;
0762: TRY
0763: FileStream := TFileStream.Create (opmG_TMPPath + opmC_TmpImg_Filename, fmOpenRead);
0764: TRY
0765: ImgFileSize := FileStream.Size;
0766: FINALLY
0767: FileStream.Free;
0768: END;
0769: EXCEPT
0770: ImgFileSize := 0;
0771: END;
0772: opm_PEdit_ImageETA[ImageIdx] := INTTOSTR (ROUND (ImgFileSize / ((opmG_ETABase * 1024) / 8))) + ' ' + _('secs') + ' @' + FLOATTOSTR (opmG_ETABase) + _('kbps');
0773: CASE ImageIdx OF
0774: 0 : BEGIN
0775: opm_PEdit_ImageData[ImageIdx] := INTTOSTR (opm_Image_Pedit0.Picture.Width) + 'x' + INTTOSTR (opm_Image_Pedit0.Picture.Height) + ', ' + INTTOSTR (ROUND (ImgFileSize / 1024)) + _('k');
0776: opm_Image_Pedit0.Hint := ImgURL + mvHint_Separator + opm_PEdit_ImageData[ImageIdx] + #13#10 + opm_PEdit_ImageETA[ImageIdx] + #13#10 + #13#10 + _('Double-click to show full-size image...');
0777: END;
0778: 1 : BEGIN
0779: opm_PEdit_ImageData[ImageIdx] := INTTOSTR (opm_Image_Pedit1.Picture.Width) + 'x' + INTTOSTR (opm_Image_Pedit1.Picture.Height) + ', ' + INTTOSTR (ROUND (ImgFileSize / 1024)) + _('k');
0780: opm_Image_Pedit1.Hint := ImgURL + mvHint_Separator + opm_PEdit_ImageData[ImageIdx] + #13#10 + opm_PEdit_ImageETA[ImageIdx] + #13#10 + #13#10 + _('Double-click to show full-size image...');
0781: END;
0782: 2 : BEGIN
0783: opm_PEdit_ImageData[ImageIdx] := INTTOSTR (opm_Image_Pedit2.Picture.Width) + 'x' + INTTOSTR (opm_Image_Pedit2.Picture.Height) + ', ' + INTTOSTR (ROUND (ImgFileSize / 1024)) + _('k');
0784: opm_Image_Pedit2.Hint := ImgURL + mvHint_Separator + opm_PEdit_ImageData[ImageIdx] + #13#10 + opm_PEdit_ImageETA[ImageIdx] + #13#10 + #13#10 + _('Double-click to show full-size image...');
0785: END;
0786: 3 : BEGIN
0787: opm_PEdit_ImageData[ImageIdx] := INTTOSTR (opm_Image_Pedit3.Picture.Width) + 'x' + INTTOSTR (opm_Image_Pedit3.Picture.Height) + ', ' + INTTOSTR (ROUND (ImgFileSize / 1024)) + _('k');
0788: opm_Image_Pedit3.Hint := ImgURL + mvHint_Separator + opm_PEdit_ImageData[ImageIdx] + #13#10 + opm_PEdit_ImageETA[ImageIdx] + #13#10 + #13#10 + _('Double-click to show full-size image...');
0789: END;
0790: 4 : BEGIN
0791: opm_PEdit_ImageData[ImageIdx] := INTTOSTR (opm_Image_Pedit4.Picture.Width) + 'x' + INTTOSTR (opm_Image_Pedit4.Picture.Height) + ', ' + INTTOSTR (ROUND (ImgFileSize / 1024)) + _('k');
0792: opm_Image_Pedit4.Hint := ImgURL + mvHint_Separator + opm_PEdit_ImageData[ImageIdx] + #13#10 + opm_PEdit_ImageETA[ImageIdx] + #13#10 + #13#10 + _('Double-click to show full-size image...');
0793: END;
0794: 5 : BEGIN
0795: opm_PEdit_ImageData[ImageIdx] := INTTOSTR (opm_Image_Pedit5.Picture.Width) + 'x' + INTTOSTR (opm_Image_Pedit5.Picture.Height) + ', ' + INTTOSTR (ROUND (ImgFileSize / 1024)) + _('k');
0796: opm_Image_Pedit5.Hint := ImgURL + mvHint_Separator + opm_PEdit_ImageData[ImageIdx] + #13#10 + opm_PEdit_ImageETA[ImageIdx] + #13#10 + #13#10 + _('Double-click to show full-size image...');
0797: END;
0798: 6 : BEGIN
0799: opm_PEdit_ImageData[ImageIdx] := INTTOSTR (opm_Image_Pedit6.Picture.Width) + 'x' + INTTOSTR (opm_Image_Pedit6.Picture.Height) + ', ' + INTTOSTR (ROUND (ImgFileSize / 1024)) + _('k');
0800: opm_Image_Pedit6.Hint := ImgURL + mvHint_Separator + opm_PEdit_ImageData[ImageIdx] + #13#10 + opm_PEdit_ImageETA[ImageIdx] + #13#10 + #13#10 + _('Double-click to show full-size image...');
0801: END;
0802: END;
0803: opm_StaticText_PeditImageData.Caption := opm_PEdit_ImageData[ImageIdx];
0804: opm_StaticText_PeditImageETA.Caption := opm_PEdit_ImageETA[ImageIdx];
0805: opm_PRSetControls (opm_CurrentImage[ImageIdx], opmC_ImageExists, FALSE, ImageIdx);
0806: END
0807: ELSE
0808: BEGIN
0809: opm_PRSetControls (opm_CurrentImage[ImageIdx], opmC_ImageIsCorrupt, TRUE, ImageIdx);
0810: END;
0811: EXCEPT
0812: opm_PRSetControls (opm_CurrentImage[ImageIdx], opmC_ImageDontExist, TRUE, ImageIdx);
0813: END
0814: ELSE opm_PRSetControls (opm_CurrentImage[ImageIdx], opmC_ImageDontExist, TRUE, ImageIdx);
0815: opm_Form_Progress.PRopm_PDClose;
0816: END;
0817:
0818:
0819:
0820: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0821: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0822: procedure Topm_Form_PEdit.opm_BitBtn_PEditDeleteImgClick(Sender: TObject);
0823: VAR
0824: ResStr : STRING;
0825: ResCode : LONGINT;
0826: begin
0827: opm_Form_Progress.PRopm_PDShow (FALSE, TRUE);
0828: opm_Form_Progress.PRopm_PDUpdate_Progress (50, 1, _('Deleting image...'));
0829: ResCode := FNopm_Send_Command (opmG_WBUploadURL, 'delete2', opm_CurrentImage[opm_CurrentImageIdx], ResStr);
0830: IF (ResCode = 0) THEN
0831: BEGIN
0832: opm_PRSetModified (TRUE);
0833: opm_PEdit_CanClose := FALSE;
0834: opm_CurrentImage[opm_CurrentImageIdx] := '';
0835: opm_PRSetControls (opm_CurrentImage[opm_CurrentImageIdx], opmC_ImageDontExist, TRUE, opm_CurrentImageIdx);
0836: END
0837: ELSE
0838: BEGIN
0839: opm_PRSetControls (opm_CurrentImage[opm_CurrentImageIdx], opmC_ImageMayExist, TRUE, opm_CurrentImageIdx);
0840: FNopm_Message (_('There was an error while deleting the file.') + #13#10 + FNopm_FullRemoteError (ResCode), mtError, [mbOk], opmG_UISilent);
0841: END;
0842: opm_Form_Progress.PRopm_PDClose;
0843: opm_Memo_UploadDEBUG.Lines.Text := opmG_HTTPClient_TransactLog;
0844: end;
0845:
0846:
0847: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0848: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0849: procedure Topm_Form_PEdit.opm_BitBtn_PEditUploadImgClick (Sender: TObject);
0850: VAR
0851: ImageJPEG : BOOLEAN;
0852: ResStr : STRING;
0853: ResCode : LONGINT;
0854: begin
0855: IF ((opmG_Cache_ImageDirList.Count < 1) OR (opmG_UICacheIList < 1)) THEN
0856: BEGIN
0857: opm_Form_Progress.PRopm_PDShow (FALSE, TRUE);
0858: opm_Form_Progress.PRopm_PDUpdate_Progress (50, 1, _('Getting list of directories...'));
0859: ResCode := FNopm_Send_Command (opmG_WBUploadURL, 'listdirs', '', ResStr);
0860: IF (ResCode <> 0) THEN FNopm_Message (_('There was an error while downloading the image directory listing.') + #13#10 + FNopm_FullRemoteError (ResCode) + #13#10 + _('I will continue as normal.'), mtWarning, [mbOk], opmG_UISilent);
0861: opm_Form_Progress.PRopm_PDClose;
0862: opm_Memo_UploadDEBUG.Lines.Text := opmG_HTTPClient_TransactLog;
0863: opmG_Cache_ImageDirList.Text := ResStr;
0864: IF (opmG_Cache_ImageDirList.Count > 1) THEN
0865: BEGIN
0866: opmG_Cache_ImageDirList.Delete (0);
0867: opmG_Cache_ImageDirList.Delete (opmG_Cache_ImageDirList.Count - 1);
0868: opmG_Cache_ImageDirList.Insert (0, '');
0869: END
0870: ELSE
0871: BEGIN
0872: opmG_Cache_ImageDirList.Clear;
0873: opmG_Cache_ImageDirList.Add ('');
0874: END;
0875: END;
0876: opm_Form_UploadImage.opm_ComboBox_UploadDir.Items.Text := opmG_Cache_ImageDirList.Text;
0877: opm_Form_UploadImage.opm_ComboBox_UploadDir.ItemIndex := 0;
0878: opm_Form_UploadImage.opm_ComboBox_UploadDir.Text := opmG_Past_PImageDir;
0879: IF (opm_Form_UploadImage.ShowModal = mrOk) THEN
0880: BEGIN
0881: opmG_Past_PImageDir := opm_Form_UploadImage.opm_ComboBox_UploadDir.Text;
0882: IF (opm_Form_UploadImage.opm_RadioGroup_UploadFormat.ItemIndex = 0) THEN ImageJPEG := TRUE ELSE ImageJPEG := FALSE;
0883: opm_PRPrepareUpload (opm_Form_UploadImage.opm_Edit_UploadFileName.Text, opm_Form_UploadImage.opm_Edit_UploadNewName.Text,
0884: opm_Form_UploadImage.opm_ComboBox_UploadDir.Text, ImageJPEG);
0885: IF (opmG_UIAutoDownImg > 0) THEN PostMessage (Handle, OPM_AUTODOWNLOADIMG, 0, LONGINT (Sender));
0886: END;
0887: end;
0888:
0889:
0890: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0891: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0892: procedure Topm_Form_PEdit.opm_PRPrepareUpload (ImageFile, NewName, ImgSubdir : STRING; ImageJPEG : BOOLEAN);
0893: VAR
0894: ConvRes : BOOLEAN;
0895: ResStr : STRING;
0896: ResCode : LONGINT;
0897: UploadResult : STRING;
0898: begin
0899: UploadResult := '';
0900: opm_PRSetControls (ImageFile, opmC_ImageIsBeingProcessed, TRUE, opm_CurrentImageIdx);
0901: IF ((ImageFile <> '') AND (NewName <> '')) THEN
0902: BEGIN
0903: opm_Form_Progress.PRopm_PDShow (FALSE, TRUE);
0904: opm_Form_Progress.PRopm_PDUpdate_Progress (30, 1, _('Deleting old image...'));
0905: ResCode := FNopm_Send_Command (opmG_WBUploadURL, 'delete2', opm_CurrentImage[opm_CurrentImageIdx], ResStr);
0906: IF ((opm_CurrentImage[opm_CurrentImageIdx] = '') OR (ResCode = 0)) THEN
0907: BEGIN
0908: ResCode := opmC_WebScriptDefaultCode;
0909: opm_Memo_UploadDEBUG.Lines.Text := opmG_HTTPClient_TransactLog;
0910: opm_PRSetModified (TRUE);
0911: opm_PEdit_CanClose := FALSE;
0912: opm_Form_Progress.PRopm_PDUpdate_Progress (60, 1, _('Converting image...'));
0913: IF (opmG_WBResizeImg > 0) THEN
0914: ConvRes := FNopm_ResizeImage2 (ImageFile, opmG_TMPPath + opmC_TmpBMP_Filename, opmG_WBImgX, opmG_WBImgY, opmG_WBKeepARImg, opmG_WBPaddingImg, opmG_WBPaddingColor)
0915: ELSE
0916: ConvRes := FNopm_ConvertImage2 (ImageFile, opmG_TMPPath + opmC_TmpBMP_Filename, opmC_BMPFormat, 1, '');
0917: IF (ConvRes = TRUE) THEN
0918: BEGIN
0919: IF (ImageJPEG = TRUE) THEN
0920: BEGIN
0921: ImageFile := opmG_TMPPath + opmC_TmpJPG_Filename;
0922: ConvRes := FNopm_ConvertImage2 (opmG_TMPPath + opmC_TmpBMP_Filename, ImageFile, opmC_JPEGFormat, opmG_WBImgQ, opmG_FullUserAgent)
0923: END
0924: ELSE
0925: BEGIN
0926: ImageFile := opmG_TMPPath + opmC_TmpPNG_Filename;
0927: ConvRes := FNopm_ConvertImage2 (opmG_TMPPath + opmC_TmpBMP_Filename, ImageFile, opmC_PNGFormat, 0, opmG_FullUserAgent);
0928: END;
0929: IF (ConvRes = TRUE) THEN
0930: BEGIN
0931: opm_Form_Progress.PRopm_PDUpdate_Progress (90, 1, _('Uploading image...'));
0932: ResCode := FNopm_Upload_File (opmG_WBUploadURL, ImageFile, NewName, ImgSubdir, UploadResult);
0933: opm_Memo_UploadDEBUG.Lines.Text := opmG_HTTPClient_TransactLog;
0934: END;
0935: END;
0936: IF ((UploadResult <> '') AND (ResCode = 0)) THEN
0937: BEGIN
0938: opm_CurrentImage[opm_CurrentImageIdx] := UploadResult;
0939: opm_PRSetControls (opm_CurrentImage[opm_CurrentImageIdx], opmC_ImageMayExist, TRUE, opm_CurrentImageIdx);
0940: opmG_Cache_ImageList.Clear;
0941: IF (ANSIPOS ('/', UploadResult) > 0) THEN
0942: BEGIN
0943: IF (opmG_Cache_ImageDirList.IndexOf (FNopm_ExtractFilePath (UploadResult, FALSE)) < 1) THEN
0944: opmG_Cache_ImageDirList.Clear;
0945: END;
0946: END
0947: ELSE
0948: BEGIN
0949: opm_CurrentImage[opm_CurrentImageIdx] := '';
0950: opm_PRSetControls (opm_CurrentImage[opm_CurrentImageIdx], opmC_ImageDontExist, TRUE, opm_CurrentImageIdx);
0951: FNopm_Message (_('There was an error while uploading the file.') + #13#10 + FNopm_FullRemoteError (ResCode), mtError, [mbOk], opmG_UISilent);
0952: END;
0953: END
0954: ELSE
0955: BEGIN
0956: opm_PRSetControls (opm_CurrentImage[opm_CurrentImageIdx], opmC_ImageDontExist, TRUE, opm_CurrentImageIdx);
0957: opm_Memo_UploadDEBUG.Lines.Text := opmG_HTTPClient_TransactLog;
0958: IF (ResCode <> 0) THEN FNopm_Message (_('There was an error while deleting the old image.') + #13#10 + FNopm_FullRemoteError (ResCode), mtError, [mbOk], opmG_UISilent);
0959: END;
0960: opm_Form_Progress.PRopm_PDClose;
0961: END
0962: ELSE opm_PRSetControls (opm_CurrentImage[opm_CurrentImageIdx], opmC_ImageDontExist, TRUE, opm_CurrentImageIdx);
0963: end;
0964:
0965:
0966: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0967: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0968: procedure Topm_Form_PEdit.FormClose (Sender: TObject; var Action: TCloseAction);
0969: begin
0970: IF (((opm_CurrentProdRecord.ImageURL <> opm_CurrentImage[0]) OR
0971: (opm_CurrentProdRecord.ImageURL1 <> opm_CurrentImage[1]) OR
0972: (opm_CurrentProdRecord.ImageURL2 <> opm_CurrentImage[2]) OR
0973: (opm_CurrentProdRecord.ImageURL3 <> opm_CurrentImage[3]) OR
0974: (opm_CurrentProdRecord.ImageURL4 <> opm_CurrentImage[4]) OR
0975: (opm_CurrentProdRecord.ImageURL5 <> opm_CurrentImage[5]) OR
0976: (opm_CurrentProdRecord.ImageURL6 <> opm_CurrentImage[6])) AND (opm_PEdit_CanClose = FALSE)) THEN
0977: BEGIN
0978: FNopm_Message (_('The product image has been changed but the product record has not been updated.'), mtWarning , [mbCancel], opmG_UISilent);
0979: Action := caNone;
0980: END;
0981: end;
0982:
0983:
0984: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0985: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
0986: PROCEDURE Topm_Form_PEdit.opm_GetDropFiles (var DropingMsg: TWMDropFiles);
0987: VAR
0988: DropFNames : ARRAY [0..MAX_PATH] of CHAR;
0989: { ResStr : STRING;}
0990: CurFName : STRING;
0991: // TotalFiles, FileCounter: LONGINT;
0992: BEGIN
0993: // TotalFiles := DragQueryFile (DropingMsg.Drop, $FFFFFFFF, DropFNames, SizeOf (CurFName));
0994: // FOR FileCounter := 0 TO (TotalFiles - 1) DO
0995: // BEGIN
0996: // CurFName := COPY (DropFNames, 0, DragQueryFile (DropingMsg.Drop, FileCounter, DropFNames, MAX_PATH));
0997: // END;
0998: IF (opmG_UIImgDragDrop > 0) THEN
0999: BEGIN
1000: CurFName := COPY (DropFNames, 0, DragQueryFile (DropingMsg.Drop, 0, DropFNames, MAX_PATH));
1001: DropingMsg.Result := 0;
1002: DragFinish (DropingMsg.Drop);
1003: opm_PRPrepareUpload (CurFName, ExtractFileName (CurFName), '', TRUE);
1004: END;
1005: END;
1006:
1007:
1008: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1009: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1010: procedure Topm_Form_PEdit.opm_BitBtn_PEditSelectImgClick(Sender: TObject);
1011: VAR
1012: ResStr : STRING;
1013: ResCode : LONGINT;
1014: BEGIN
1015: IF ((opmG_Cache_ImageList.Count < 1) OR (opmG_UICacheIList < 1)) THEN
1016: BEGIN
1017: opm_Form_Progress.PRopm_PDShow (FALSE, TRUE);
1018: opm_Form_Progress.PRopm_PDUpdate_Progress (50, 1, _('Getting image list...'));
1019: ResCode := FNopm_Send_Command (opmG_WBUploadURL, 'list', '', ResStr);
1020: opm_Form_Progress.PRopm_PDClose;
1021: opm_Memo_UploadDEBUG.Lines.Text := opmG_HTTPClient_TransactLog;
1022: opmG_Cache_ImageList.Text := ResStr;
1023: IF (ResCode <> 0) THEN FNopm_Message (_('There was an error while downloading the images listing.') + #13#10 + FNopm_FullRemoteError (ResCode) + #13#10 + _('I will continue as normal.'), mtWarning, [mbOk], opmG_UISilent);
1024: END;
1025: opm_Form_AskUser.AU_DataListText := opmG_Cache_ImageList.Text;
1026: IF (opm_Form_AskUser.AU_DataListText <> '') THEN
1027: BEGIN
1028: opm_Form_AskUser.AU_PreCleanList := TRUE;
1029: opm_Form_AskUser.AU_Title := _('Select the image image...');
1030: opm_Form_AskUser.AU_ListItem := 0;
1031: opm_Form_AskUser.AU_Directions := _('Select the image for the product:');
1032: opm_Form_AskUser.AU_TextOrList := FALSE;
1033: opm_Form_AskUser.AU_PassChar := #0;
1034: IF (opm_Form_AskUser.ShowModal = mrOk) THEN
1035: BEGIN
1036: opm_PRSetModified (TRUE);
1037: opm_PEdit_CanClose := FALSE;
1038: opm_CurrentImage[opm_CurrentImageIdx] := TRIM (opm_Form_AskUser.AU_DataText);
1039: opm_PRSetControls (opm_CurrentImage[opm_CurrentImageIdx], opmC_ImageExists, TRUE, opm_CurrentImageIdx);
1040: END
1041: ELSE
1042: BEGIN
1043: opm_CurrentImage[opm_CurrentImageIdx] := '';
1044: opm_PRSetControls (opm_CurrentImage[opm_CurrentImageIdx], opmC_ImageDontExist, TRUE, opm_CurrentImageIdx);
1045: END;
1046: END
1047: ELSE
1048: BEGIN
1049: FNopm_Message (_('There was an error while getting image files list.'), mtError, [mbOk], opmG_UISilent);
1050: END;
1051: end;
1052:
1053: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1054: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1055: procedure Topm_Form_PEdit.opm_PopMenuItem_HideUploadDebugClick (Sender: TObject);
1056: begin
1057: opmG_UIWBDebug := 0;
1058: PRReg_WriteSetting ('OSCWBDebug', INTTOSTR (opmG_UIWBDebug), opmC_RegistryKey, opmC_RKConfig);
1059: opm_Memo_UploadDEBUG.Enabled := FALSE;
1060: opm_Memo_UploadDEBUG.Visible := FALSE;
1061: opm_Memo_UploadDEBUG.Clear;
1062: end;
1063:
1064:
1065: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1066: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1067: FUNCTION Topm_Form_PEdit.opm_FNCleanURL (ProductURL : STRING) : STRING;
1068: BEGIN
1069: ProductURL := TRIM (ProductURL);
1070: IF (ANSIUPPERCASE (COPY (ProductURL, 1, 7)) = 'HTTP://') THEN ProductURL := COPY (ProductURL, 8, opmC_ProdURL_MaxLen);
1071: opm_FNCleanURL := ProductURL;
1072: END;
1073:
1074:
1075: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1076: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1077: procedure Topm_Form_PEdit.opm_TabControl_PEditChange(Sender: TObject);
1078: begin
1079: IF (opm_CurrentSingleDescList[opm_TabControl_PEdit.TabIndex].ID > 0) THEN
1080: BEGIN
1081: opm_Edit_PEditName.Text := opm_CurrentSingleDescList[opm_TabControl_PEdit.TabIndex].Name;
1082: opm_Edit_PEditURL.Text := opm_FNCleanURL (opm_CurrentSingleDescList[opm_TabControl_PEdit.TabIndex].URL);
1083: opm_StaticText_PeditViewed.Caption := INTTOSTR (opm_CurrentSingleDescList[opm_TabControl_PEdit.TabIndex].Viewed);
1084: opm_Memo_PEditDescription.Lines.Text := opm_CurrentSingleDescList[opm_TabControl_PEdit.TabIndex].Description;
1085: opm_Memo_PEditDescription.SelStart := opm_PEdit_CursorPos[opm_TabControl_PEdit.TabIndex];
1086: END
1087: ELSE
1088: BEGIN
1089: opm_CurrentSingleDescList[opm_TabControl_PEdit.TabIndex].ID := opm_CurrentProdRecord.ID;
1090: opm_CurrentSingleDescList[opm_TabControl_PEdit.TabIndex].LanguageID := opmG_LanguageList[opm_TabControl_PEdit.TabIndex].ID;
1091: opm_CurrentSingleDescList[opm_TabControl_PEdit.TabIndex].Name := '';
1092: opm_CurrentSingleDescList[opm_TabControl_PEdit.TabIndex].URL := '';
1093: opm_CurrentSingleDescList[opm_TabControl_PEdit.TabIndex].Viewed := 0;
1094: opm_CurrentSingleDescList[opm_TabControl_PEdit.TabIndex].Description := '';
1095: opm_Edit_PEditName.Text := opm_CurrentSingleDescList[opm_TabControl_PEdit.TabIndex].Name;
1096: opm_Edit_PEditURL.Text := opm_FNCleanURL (opm_CurrentSingleDescList[opm_TabControl_PEdit.TabIndex].URL);
1097: opm_StaticText_PeditViewed.Caption := INTTOSTR (opm_CurrentSingleDescList[opm_TabControl_PEdit.TabIndex].Viewed);
1098: opm_Memo_PEditDescription.Lines.Text := opm_CurrentSingleDescList[opm_TabControl_PEdit.TabIndex].Description;
1099: opm_PEdit_CursorPos[opm_TabControl_PEdit.TabIndex] := 0;
1100: opm_Memo_PEditDescription.SelStart := 0;
1101: END;
1102: end;
1103:
1104:
1105: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1106: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1107: procedure Topm_Form_PEdit.opm_TabControl_PEditChanging(Sender: TObject; var AllowChange: Boolean);
1108: begin
1109: opm_CurrentSingleDescList[opm_TabControl_PEdit.TabIndex].Name := FNopm_CleanString (opm_Edit_PEditName.Text);
1110: opm_CurrentSingleDescList[opm_TabControl_PEdit.TabIndex].URL := opm_FNCleanURL (opm_Edit_PEditURL.Text);
1111: opm_CurrentSingleDescList[opm_TabControl_PEdit.TabIndex].Description := FNopm_CleanString (opm_Memo_PEditDescription.Lines.Text);
1112: opm_PEdit_CursorPos[opm_TabControl_PEdit.TabIndex] := opm_Memo_PEditDescription.SelStart;
1113: end;
1114:
1115: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1116: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1117: procedure Topm_Form_PEdit.opm_BitBtn_PEditStripHTMLClick(Sender: TObject);
1118: begin
1119: opm_Edit_PEditName.Text := FNopm_StripHTML (opm_Edit_PEditName.Text);
1120: opm_Memo_PEditDescription.Lines.Text := FNopm_StripHTML (opm_Memo_PEditDescription.Lines.Text);
1121: opm_PEdit_CursorPos[opm_TabControl_PEdit.TabIndex] := 0;
1122: opm_Memo_PEditDescription.SelStart := 0;
1123: opm_Form_PEdit.FocusControl (opm_Memo_PEditDescription);
1124: opm_PRSetModified (TRUE);
1125: end;
1126:
1127: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1128: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1129: procedure Topm_Form_PEdit.opm_ComboBox_PEditTaxChange(Sender: TObject);
1130: begin
1131: IF (opm_PEdit_CalcNewTax = TRUE) THEN
1132: BEGIN
1133: opm_CurrentTaxRecord := FNopm_GetTax (opmG_TaxList, opm_ComboBox_PEditTax.ItemIndex, opmC_FindByIndex);
1134: opm_Edit_PEditPriceTaxed.Text := FNopm_AfterTaxPrice (opm_Edit_PEditPrice.Text, opm_CurrentTaxRecord.SumRate);
1135: END;
1136: opm_PRSetModified (TRUE);
1137: end;
1138:
1139: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1140: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1141: procedure Topm_Form_PEdit.opm_Edit_PEditPriceChange(Sender: TObject);
1142: begin
1143: IF (opm_PEdit_CalcTaxed = TRUE) THEN
1144: opm_Edit_PEditPriceTaxed.Text := FNopm_AfterTaxPrice (opm_Edit_PEditPrice.Text, opm_CurrentTaxRecord.SumRate);
1145: opm_PRSetModified (TRUE);
1146: end;
1147:
1148:
1149: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1150: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1151: procedure Topm_Form_PEdit.opm_Edit_PEditPriceTaxedChange(Sender: TObject);
1152: begin
1153: IF (opm_PEdit_CalcUnTaxed = TRUE) THEN
1154: opm_Edit_PEditPrice.Text := FNopm_BeforeTaxPrice (opm_Edit_PEditPriceTaxed.Text, opm_CurrentTaxRecord.SumRate);
1155: opm_PRSetModified (TRUE);
1156: end;
1157:
1158:
1159:
1160: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1161: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1162: procedure Topm_Form_PEdit.opm_Edit_PEditPriceEnter(Sender: TObject);
1163: begin
1164: opm_PEdit_CalcTaxed := TRUE;
1165: end;
1166:
1167: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1168: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1169: procedure Topm_Form_PEdit.opm_Edit_PEditPriceExit(Sender: TObject);
1170: begin
1171: opm_PEdit_CalcTaxed := FALSE;
1172: end;
1173:
1174: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1175: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1176: procedure Topm_Form_PEdit.opm_Edit_PEditPriceTaxedEnter(Sender: TObject);
1177: begin
1178: opm_PEdit_CalcUnTaxed := TRUE;
1179: end;
1180:
1181: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1182: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1183: procedure Topm_Form_PEdit.opm_Edit_PEditPriceTaxedExit(Sender: TObject);
1184: begin
1185: opm_PEdit_CalcUnTaxed := FALSE;
1186: end;
1187:
1188:
1189: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1190: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1191: FUNCTION Topm_Form_PEdit.FNopm_GetTax (VAR TaxList : opmT_TaxList; TaxID : LONGINT; SearchBy : INTEGER) : opmR_Tax;
1192: VAR
1193: CurTaxR : opmR_Tax;
1194: CurTax : LONGINT;
1195: BEGIN
1196: CurTaxR.ID := 0;
1197: CurTaxR.Name := '';
1198: CurTaxR.ListIndex := 0;
1199: CurTaxR.SumRate := 0;
1200: FNopm_GetTax := CurTaxR;
1201: IF (SearchBy = opmC_FindByID) THEN
1202: FOR CurTax := 0 TO (opm_TotalTaxes - 1) DO
1203: BEGIN
1204: IF (TaxList[CurTax].ID = TaxID) THEN
1205: BEGIN
1206: CurTaxR.ID := TaxList[CurTax].ID;
1207: CurTaxR.Name := TaxList[CurTax].Name;
1208: CurTaxR.ListIndex := TaxList[CurTax].ListIndex;
1209: CurTaxR.SumRate := TaxList[CurTax].SumRate;
1210: FNopm_GetTax := CurTaxR;
1211: BREAK;
1212: END;
1213: END
1214: ELSE
1215: FOR CurTax := 0 TO (opm_TotalTaxes - 1) DO
1216: BEGIN
1217: IF (TaxList[CurTax].ListIndex = TaxID) THEN
1218: BEGIN
1219: CurTaxR.ID := TaxList[CurTax].ID;
1220: CurTaxR.Name := TaxList[CurTax].Name;
1221: CurTaxR.ListIndex := TaxList[CurTax].ListIndex;
1222: CurTaxR.SumRate := TaxList[CurTax].SumRate;
1223: FNopm_GetTax := CurTaxR;
1224: BREAK;
1225: END;
1226: END;
1227: END;
1228:
1229:
1230:
1231: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1232: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1233: procedure Topm_Form_PEdit.opm_Edit_PeditImageURLExit(Sender: TObject);
1234: begin
1235: IF (opm_CurrentImage[opm_CurrentImageIdx] <> opm_Edit_PeditImageURL.Text) THEN
1236: BEGIN
1237: opm_Edit_PeditImageURL.Text := FNopm_CleanUploadName (opm_Edit_PeditImageURL.Text);
1238: IF (opm_CurrentImage[opm_CurrentImageIdx] <> opm_Edit_PeditImageURL.Text) THEN
1239: BEGIN
1240: opm_CurrentImage[opm_CurrentImageIdx] := opm_Edit_PeditImageURL.Text;
1241: opm_PRSetControls (opm_CurrentImage[opm_CurrentImageIdx], opmC_ImageMayExist, TRUE, opm_CurrentImageIdx);
1242: opm_PRSetModified (TRUE);
1243: END;
1244: END;
1245: end;
1246:
1247:
1248:
1249: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1250: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1251: procedure Topm_Form_PEdit.opm_BitBtn_PEditUnlinkImgClick(Sender: TObject);
1252: begin
1253: opm_CurrentImage[opm_CurrentImageIdx] := '';
1254: opm_PRSetControls (opm_CurrentImage[opm_CurrentImageIdx], opmC_ImageIsEmpty, TRUE, opm_CurrentImageIdx);
1255: opm_PRSetModified (TRUE);
1256: end;
1257:
1258:
1259:
1260: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1261: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1262: PROCEDURE Topm_Form_PEdit.opm_PRSetModified (IsModified: BOOLEAN);
1263: BEGIN
1264: IF (ProductModified <> IsModified) THEN
1265: BEGIN
1266: ProductModified := IsModified;
1267: IF (IsModified = TRUE) THEN opm_Form_PEdit.Caption := '* ' + opm_CurrentProdRecord.DisplayName
1268: ELSE opm_Form_PEdit.Caption := opm_CurrentProdRecord.DisplayName;
1269: END;
1270: END;
1271:
1272:
1273:
1274: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1275: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1276: PROCEDURE Topm_Form_PEdit.opm_Control_SetChange (Sender: TObject);
1277: begin
1278: opm_PRSetModified (TRUE);
1279: end;
1280:
1281:
1282: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1283: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1284: procedure Topm_Form_PEdit.opm_Image_Pedit0Click(Sender: TObject);
1285: begin
1286: opm_PRToggle_ImgSel (0, opm_CurrentImageIdx);
1287: opm_CurrentImageIdx := 0;
1288: opm_PRSetControls (opm_CurrentImage[opm_CurrentImageIdx], opm_PEdit_ImageExist[opm_CurrentImageIdx], FALSE, opm_CurrentImageIdx);
1289: opm_PRCenterImage (opm_Panel_PeditImage0);
1290: end;
1291:
1292:
1293: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1294: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1295: procedure Topm_Form_PEdit.opm_Image_Pedit1Click(Sender: TObject);
1296: begin
1297: opm_PRToggle_ImgSel (1, opm_CurrentImageIdx);
1298: opm_CurrentImageIdx := 1;
1299: opm_PRSetControls (opm_CurrentImage[opm_CurrentImageIdx], opm_PEdit_ImageExist[opm_CurrentImageIdx], FALSE, opm_CurrentImageIdx);
1300: opm_PRCenterImage (opm_Panel_PeditImage1);
1301: end;
1302:
1303: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1304: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1305: procedure Topm_Form_PEdit.opm_Image_Pedit2Click(Sender: TObject);
1306: begin
1307: opm_PRToggle_ImgSel (2, opm_CurrentImageIdx);
1308: opm_CurrentImageIdx := 2;
1309: opm_PRSetControls (opm_CurrentImage[opm_CurrentImageIdx], opm_PEdit_ImageExist[opm_CurrentImageIdx], FALSE, opm_CurrentImageIdx);
1310: opm_PRCenterImage (opm_Panel_PeditImage2);
1311: end;
1312:
1313: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1314: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1315: procedure Topm_Form_PEdit.opm_Image_Pedit3Click(Sender: TObject);
1316: begin
1317: opm_PRToggle_ImgSel (3, opm_CurrentImageIdx);
1318: opm_CurrentImageIdx := 3;
1319: opm_PRSetControls (opm_CurrentImage[opm_CurrentImageIdx], opm_PEdit_ImageExist[opm_CurrentImageIdx], FALSE, opm_CurrentImageIdx);
1320: opm_PRCenterImage (opm_Panel_PeditImage3);
1321: end;
1322:
1323: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1324: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1325: procedure Topm_Form_PEdit.opm_Image_Pedit4Click(Sender: TObject);
1326: begin
1327: opm_PRToggle_ImgSel (4, opm_CurrentImageIdx);
1328: opm_CurrentImageIdx := 4;
1329: opm_PRSetControls (opm_CurrentImage[opm_CurrentImageIdx], opm_PEdit_ImageExist[opm_CurrentImageIdx], FALSE, opm_CurrentImageIdx);
1330: opm_PRCenterImage (opm_Panel_PeditImage4);
1331: end;
1332:
1333: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1334: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1335: procedure Topm_Form_PEdit.opm_Image_Pedit5Click(Sender: TObject);
1336: begin
1337: opm_PRToggle_ImgSel (5, opm_CurrentImageIdx);
1338: opm_CurrentImageIdx := 5;
1339: opm_PRSetControls (opm_CurrentImage[opm_CurrentImageIdx], opm_PEdit_ImageExist[opm_CurrentImageIdx], FALSE, opm_CurrentImageIdx);
1340: opm_PRCenterImage (opm_Panel_PeditImage5);
1341: end;
1342:
1343: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1344: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1345: procedure Topm_Form_PEdit.opm_Image_Pedit6Click(Sender: TObject);
1346: begin
1347: opm_PRToggle_ImgSel (6, opm_CurrentImageIdx);
1348: opm_CurrentImageIdx := 6;
1349: opm_PRSetControls (opm_CurrentImage[opm_CurrentImageIdx], opm_PEdit_ImageExist[opm_CurrentImageIdx], FALSE, opm_CurrentImageIdx);
1350: opm_PRCenterImage (opm_Panel_PeditImage6);
1351: end;
1352:
1353:
1354: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1355: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1356: procedure Topm_Form_PEdit.opm_Image_Pedit0DblClick(Sender: TObject);
1357: begin
1358: IF (opm_PEdit_CanZoom[0] = TRUE) THEN
1359: BEGIN
1360: opm_Form_ImageZoom.Caption := opm_CurrentImage[opm_CurrentImageIdx];
1361: opm_Form_ImageZoom.opm_Image_ZoomImage.Picture := opm_Image_Pedit0.Picture;
1362: opm_Form_ImageZoom.opm_Image_ZoomImage.Hint := opm_CurrentImage[0] + mvHint_Separator + opm_PEdit_ImageData[0] + #13#10 + opm_PEdit_ImageETA[0];
1363: opm_Form_ImageZoom.Show;
1364: END;
1365: end;
1366:
1367: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1368: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1369: procedure Topm_Form_PEdit.opm_Image_Pedit1DblClick(Sender: TObject);
1370: begin
1371: IF (opm_PEdit_CanZoom[1] = TRUE) THEN
1372: BEGIN
1373: opm_Form_ImageZoom.Caption := opm_CurrentImage[opm_CurrentImageIdx];
1374: opm_Form_ImageZoom.opm_Image_ZoomImage.Picture := opm_Image_Pedit1.Picture;
1375: opm_Form_ImageZoom.opm_Image_ZoomImage.Hint := opm_CurrentImage[1] + mvHint_Separator + opm_PEdit_ImageData[1] + #13#10 + opm_PEdit_ImageETA[1];
1376: opm_Form_ImageZoom.Show;
1377: END;
1378: end;
1379:
1380: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1381: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1382: procedure Topm_Form_PEdit.opm_Image_Pedit2DblClick(Sender: TObject);
1383: begin
1384: IF (opm_PEdit_CanZoom[2] = TRUE) THEN
1385: BEGIN
1386: opm_Form_ImageZoom.Caption := opm_CurrentImage[opm_CurrentImageIdx];
1387: opm_Form_ImageZoom.opm_Image_ZoomImage.Picture := opm_Image_Pedit2.Picture;
1388: opm_Form_ImageZoom.opm_Image_ZoomImage.Hint := opm_CurrentImage[2] + mvHint_Separator + opm_PEdit_ImageData[2] + #13#10 + opm_PEdit_ImageETA[2];
1389: opm_Form_ImageZoom.Show;
1390: END;
1391: end;
1392:
1393: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1394: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1395: procedure Topm_Form_PEdit.opm_Image_Pedit3DblClick(Sender: TObject);
1396: begin
1397: IF (opm_PEdit_CanZoom[3] = TRUE) THEN
1398: BEGIN
1399: opm_Form_ImageZoom.Caption := opm_CurrentImage[opm_CurrentImageIdx];
1400: opm_Form_ImageZoom.opm_Image_ZoomImage.Picture := opm_Image_Pedit3.Picture;
1401: opm_Form_ImageZoom.opm_Image_ZoomImage.Hint := opm_CurrentImage[3] + mvHint_Separator + opm_PEdit_ImageData[3] + #13#10 + opm_PEdit_ImageETA[3];
1402: opm_Form_ImageZoom.Show;
1403: END;
1404: end;
1405:
1406: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1407: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1408: procedure Topm_Form_PEdit.opm_Image_Pedit4DblClick(Sender: TObject);
1409: begin
1410: IF (opm_PEdit_CanZoom[4] = TRUE) THEN
1411: BEGIN
1412: opm_Form_ImageZoom.Caption := opm_CurrentImage[opm_CurrentImageIdx];
1413: opm_Form_ImageZoom.opm_Image_ZoomImage.Picture := opm_Image_Pedit4.Picture;
1414: opm_Form_ImageZoom.Show;
1415: opm_Form_ImageZoom.opm_Image_ZoomImage.Hint := opm_CurrentImage[4] + mvHint_Separator + opm_PEdit_ImageData[4] + #13#10 + opm_PEdit_ImageETA[4];
1416: END;
1417: end;
1418:
1419: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1420: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1421: procedure Topm_Form_PEdit.opm_Image_Pedit5DblClick(Sender: TObject);
1422: begin
1423: IF (opm_PEdit_CanZoom[5] = TRUE) THEN
1424: BEGIN
1425: opm_Form_ImageZoom.Caption := opm_CurrentImage[opm_CurrentImageIdx];
1426: opm_Form_ImageZoom.opm_Image_ZoomImage.Picture := opm_Image_Pedit5.Picture;
1427: opm_Form_ImageZoom.opm_Image_ZoomImage.Hint := opm_CurrentImage[5] + mvHint_Separator + opm_PEdit_ImageData[5] + #13#10 + opm_PEdit_ImageETA[5];
1428: opm_Form_ImageZoom.Show;
1429: END;
1430: end;
1431:
1432: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1433: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1434: procedure Topm_Form_PEdit.opm_Image_Pedit6DblClick(Sender: TObject);
1435: begin
1436: IF (opm_PEdit_CanZoom[6] = TRUE) THEN
1437: BEGIN
1438: opm_Form_ImageZoom.Caption := opm_CurrentImage[opm_CurrentImageIdx];
1439: opm_Form_ImageZoom.opm_Image_ZoomImage.Picture := opm_Image_Pedit6.Picture;
1440: opm_Form_ImageZoom.opm_Image_ZoomImage.Hint := opm_CurrentImage[6] + mvHint_Separator + opm_PEdit_ImageData[6] + #13#10 + opm_PEdit_ImageETA[6];
1441: opm_Form_ImageZoom.Show;
1442: END;
1443: end;
1444:
1445: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1446: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1447: procedure Topm_Form_PEdit.opm_BitBtn_PEditDownAllClick(Sender: TObject);
1448: VAR
1449: CurImg : LONGINT;
1450: begin
1451: IF (opmG_Capa_MorePics6 = TRUE) THEN
1452: BEGIN
1453: opm_BitBtn_PEditDown.Enabled := FALSE;
1454: opm_BitBtn_PEditStopDown.Visible := TRUE;
1455: opm_BitBtn_PEditStopDown.Enabled := TRUE;
1456: FOR CurImg := 0 TO 6 DO
1457: BEGIN
1458: opm_PRSetControls (opm_CurrentImage[CurImg], opmC_ImageMayExist, TRUE, CurImg);
1459: IF (opm_CurrentImage[CurImg] <> '') THEN
1460: BEGIN
1461: opm_PRDownload_Image (opm_CurrentImage[CurImg], CurImg);
1462: END;
1463: END;
1464: opm_BitBtn_PEditDown.Enabled := TRUE;
1465: opm_BitBtn_PEditStopDown.Visible := FALSE;
1466: opm_BitBtn_PEditStopDown.Enabled := FALSE;
1467: opm_PRToggle_ImgSel (0, opm_CurrentImageIdx);
1468: opm_CurrentImageIdx := 0;
1469: opm_PRSetControls (opm_CurrentImage[opm_CurrentImageIdx], opm_PEdit_ImageExist[opm_CurrentImageIdx], FALSE, opm_CurrentImageIdx);
1470: END;
1471: end;
1472:
1473:
1474:
1475: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1476: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1477: procedure Topm_Form_PEdit.opm_Image_Pedit0DragOver(Sender, Source: TObject;
1478: X, Y: Integer; State: TDragState;
1479: var Accept: Boolean);
1480: begin
1481: IF ((opmG_Capa_MorePics6 = TRUE) AND (Source IS TImage) AND (Sender <> Source)) THEN
1482: BEGIN
1483: Accept := TRUE;
1484: END
1485: ELSE
1486: BEGIN
1487: Accept := FALSE;
1488: END;
1489: end;
1490:
1491:
1492: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1493: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1494: procedure Topm_Form_PEdit.opm_Image_Pedit0MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
1495: begin
1496: IF (opmG_Capa_MorePics6 = TRUE) THEN TControl(Sender).BeginDrag (FALSE, -1);
1497: end;
1498:
1499:
1500:
1501: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1502: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1503: procedure Topm_Form_PEdit.opm_Image_Pedit0DragDrop(Sender, Source: TObject; X, Y: Integer);
1504: VAR
1505: SwapImage : TPICTURE;
1506: SwapName : STRING;
1507: SwapZoom : BOOLEAN;
1508: SwapExist : LONGINT;
1509: SourceTImg, TargetTImg : STRING;
1510: SourceImg, TargetImg : WORD;
1511: begin
1512: IF ((opmG_Capa_MorePics6 = TRUE) AND (Source IS TImage) AND (Sender <> Source)) THEN
1513: BEGIN
1514: SourceTImg := TImage(Source).Name;
1515: TargetTImg := TImage(Sender).Name;
1516: IF (ANSIPOS ('opm_Image_Pedit', SourceTImg) > 0) THEN
1517: BEGIN
1518: TRY
1519: SwapImage := TPicture.Create;
1520: TRY
1521: SwapImage.Assign (TImage(Source).Picture.Bitmap);
1522: TImage(Source).Picture.Bitmap := TImage(Sender).Picture.Bitmap;
1523: TImage(Sender).Picture.Bitmap := SwapImage.Bitmap;
1524: SourceImg := STRTOINT (COPY (SourceTImg, LENGTH (SourceTImg), 1));
1525: TargetImg := STRTOINT (COPY (TargetTImg, LENGTH (TargetTImg), 1));
1526:
1527: SwapName := opm_CurrentImage[SourceImg];
1528: opm_CurrentImage[SourceImg] := opm_CurrentImage[TargetImg];
1529: opm_CurrentImage[TargetImg] := SwapName;
1530:
1531: SwapName := opm_PEdit_ImageData[SourceImg];
1532: opm_PEdit_ImageData[SourceImg] := opm_PEdit_ImageData[TargetImg];
1533: opm_PEdit_ImageData[TargetImg] := SwapName;
1534:
1535: SwapName := opm_PEdit_ImageETA[SourceImg];
1536: opm_PEdit_ImageETA[SourceImg] := opm_PEdit_ImageETA[TargetImg];
1537: opm_PEdit_ImageETA[TargetImg] := SwapName;
1538:
1539: SwapZoom := opm_PEdit_CanZoom[SourceImg];
1540: opm_PEdit_CanZoom[SourceImg] := opm_PEdit_CanZoom[TargetImg];
1541: opm_PEdit_CanZoom[TargetImg] := SwapZoom;
1542:
1543: SwapExist := opm_PEdit_ImageExist[SourceImg];
1544: opm_PEdit_ImageExist[SourceImg] := opm_PEdit_ImageExist[TargetImg];
1545: opm_PEdit_ImageExist[TargetImg] := SwapExist;
1546:
1547: TImage(Source).Hint := opm_CurrentImage[SourceImg] + mvHint_Separator + opm_PEdit_ImageData[SourceImg] + #13#10 + opm_PEdit_ImageETA[SourceImg] + #13#10 + #13#10 + _('Double-click to show full-size image...');
1548: TImage(Sender).Hint := opm_CurrentImage[TargetImg] + mvHint_Separator + opm_PEdit_ImageData[TargetImg] + #13#10 + opm_PEdit_ImageETA[TargetImg] + #13#10 + #13#10 + _('Double-click to show full-size image...');
1549:
1550: opm_PRToggle_ImgSel (TargetImg, opm_CurrentImageIdx);
1551: opm_CurrentImageIdx := TargetImg;
1552: opm_PRSetControls (opm_CurrentImage[opm_CurrentImageIdx], opm_PEdit_ImageExist[opm_CurrentImageIdx], FALSE, opm_CurrentImageIdx);
1553:
1554: opm_PRSetModified (TRUE);
1555: opm_PEdit_CanClose := FALSE;
1556: FINALLY
1557: SwapImage.Free;
1558: END;
1559: EXCEPT
1560: END;
1561: END;
1562: END;
1563: end;
1564:
1565:
1566: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1567: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1568: PROCEDURE Topm_Form_PEdit.opm_InterceptKeys (var KeyPressMsg: TCMDialogKey);
1569: BEGIN
1570: IF (opm_ScrollBox_PeditImage.Focused = TRUE) AND (KeyPressMsg.CharCode IN [VK_LEFT, VK_RIGHT, VK_UP, VK_DOWN]) THEN
1571: BEGIN
1572: CASE KeyPressMsg.CharCode OF
1573: VK_LEFT, VK_UP : opm_ScrollBox_PeditImage.HorzScrollBar.Position := opm_ScrollBox_PeditImage.HorzScrollBar.Position - opm_ScrollBox_PeditImage.HorzScrollBar.Increment;
1574: VK_RIGHT, VK_DOWN : opm_ScrollBox_PeditImage.HorzScrollBar.Position := opm_ScrollBox_PeditImage.HorzScrollBar.Position + opm_ScrollBox_PeditImage.HorzScrollBar.Increment;
1575: END;
1576: KeyPressMsg.Result := 1;
1577: END
1578: ELSE INHERITED;
1579: END;
1580:
1581:
1582: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1583: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1584: procedure Topm_Form_PEdit.opm_ScrollBox_PeditImageEnter(Sender: TObject);
1585: begin
1586: opm_ScrollBox_PeditImage.Color := clHighlight;
1587: end;
1588:
1589:
1590: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1591: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1592: procedure Topm_Form_PEdit.opm_ScrollBox_PeditImageExit(Sender: TObject);
1593: begin
1594: opm_ScrollBox_PeditImage.Color := clBtnFace;
1595: end;
1596:
1597:
1598: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1599: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1600: procedure Topm_Form_PEdit.opm_SpeedButton_ClearImgCacheClick (Sender: TObject);
1601: begin
1602: opmG_Cache_ImageList.Clear;
1603: opmG_Cache_ImageDirList.Clear;
1604: end;
1605:
1606:
1607: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1608: {%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
1609: PROCEDURE Topm_Form_PEdit.opm_PRCenterImage (SelectedPanel : TPanel);
1610: BEGIN
1611: opm_ScrollBox_PeditImage.HorzScrollBar.Position := opm_ScrollBox_PeditImage.HorzScrollBar.Position - (opm_ScrollBox_PeditImage.Width DIV 2) + SelectedPanel.Left + (SelectedPanel.Width DIV 2);
1612: END;
1613:
1614:
1615:
1616: end.