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