Source code of file oscpmwin_v0.1.1.875/pedit.pas from the
osCommerce Product Manager for Windows.


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