|
@@ -242,9 +242,8 @@ laFileBrowser *la_FileBrowserInit(laOperator *a){
|
|
|
|
|
|
strcpy(fb->Path, MAIN.WorkingDirectory->Ptr);
|
|
strcpy(fb->Path, MAIN.WorkingDirectory->Ptr);
|
|
|
|
|
|
- if (strArgumentMatch(a->ExtraInstructionsP, "select", "folder")){
|
|
|
|
- fb->SelectFolder = LA_FILE_SELECT_FOLDER;
|
|
|
|
- }
|
|
|
|
|
|
+ if (strArgumentMatch(a->ExtraInstructionsP, "select", "folder")){ fb->SelectFolder = LA_FILE_SELECT_FOLDER; }
|
|
|
|
+ if (strArgumentMatch(a->ExtraInstructionsP, "warn_file_exists", "true")){ fb->WarnFileExists = 1; }
|
|
|
|
|
|
la_FileBrowserRebuildList(fb);
|
|
la_FileBrowserRebuildList(fb);
|
|
|
|
|
|
@@ -267,14 +266,18 @@ void laset_FileBrowserSelectFile(laFileBrowser *fb, laFileItem *fi, int State){
|
|
fb->Active = fi;
|
|
fb->Active = fi;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-int la_FileBrowserConfirm(laOperator *a, laFileBrowser *fb){
|
|
|
|
- char buf[2048] = {0};
|
|
|
|
|
|
+void* la_FileBrowserGetFullPath(laFileBrowser *fb,char* buf){
|
|
|
|
+ buf[0]=0;
|
|
int plen;
|
|
int plen;
|
|
- if (!fb->SelectFolder && fb->FileName[0] == L'\0') return 0;
|
|
|
|
|
|
+ if (!fb->SelectFolder && fb->FileName[0] == L'\0') return;
|
|
plen = strlen(fb->Path);
|
|
plen = strlen(fb->Path);
|
|
if (fb->Path[plen - 1] != L'/') strcat(fb->Path, "/");
|
|
if (fb->Path[plen - 1] != L'/') strcat(fb->Path, "/");
|
|
strCopyFull(buf, fb->Path);
|
|
strCopyFull(buf, fb->Path);
|
|
strcat(buf, fb->FileName);
|
|
strcat(buf, fb->FileName);
|
|
|
|
+}
|
|
|
|
+int la_FileBrowserConfirm(laOperator *a, laFileBrowser *fb){
|
|
|
|
+ char buf[2048];
|
|
|
|
+ la_FileBrowserGetFullPath(fb,buf);
|
|
laConfirmString(a, buf, LA_CONFIRM_OK);
|
|
laConfirmString(a, buf, LA_CONFIRM_OK);
|
|
return 1;
|
|
return 1;
|
|
}
|
|
}
|
|
@@ -329,14 +332,11 @@ int OPMOD_FileBrowser(laOperator *a, laEvent *e){
|
|
|
|
|
|
if (a->ConfirmData){
|
|
if (a->ConfirmData){
|
|
if (a->ConfirmData->Mode == LA_CONFIRM_CANCEL){
|
|
if (a->ConfirmData->Mode == LA_CONFIRM_CANCEL){
|
|
- laConfirmSameDataIfAny(a);
|
|
|
|
- return LA_FINISHED_PASS;
|
|
|
|
|
|
+ if(fb->StatusWaitingWarning){ fb->StatusWaitingWarning=0; return LA_RUNNING; }
|
|
|
|
+ laConfirmSameDataIfAny(a); return LA_FINISHED_PASS;
|
|
}
|
|
}
|
|
if (a->ConfirmData->Mode == LA_CONFIRM_OK){
|
|
if (a->ConfirmData->Mode == LA_CONFIRM_OK){
|
|
- if (la_FileBrowserConfirm(a, fb)){
|
|
|
|
- //MessageBox(0, a->NextConfirmData->StrData, "!", 0);
|
|
|
|
- }
|
|
|
|
- return LA_FINISHED_PASS;
|
|
|
|
|
|
+ la_FileBrowserConfirm(a, fb); return LA_FINISHED_PASS;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -359,6 +359,40 @@ int OPINV_FileBrowserUpLevel(laOperator *a, laEvent *e){
|
|
}
|
|
}
|
|
return LA_FINISHED_PASS;
|
|
return LA_FINISHED_PASS;
|
|
}
|
|
}
|
|
|
|
+int OPCHK_FileBrowserCanConfirm(laPropPack *This, laStringSplitor *ss){
|
|
|
|
+ if(!OPCHK_IsFileBrowser(This,ss)) return 0;
|
|
|
|
+ laFileBrowser* fb=This->EndInstance;
|
|
|
|
+ if(fb->SelectFolder) return 1;
|
|
|
|
+ if(fb->FileName[0]) return 1;
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+int OPINV_FileBrowserConfirm(laOperator *a, laEvent *e){
|
|
|
|
+ if (a->This){
|
|
|
|
+ laFileBrowser* fb=a->This->LastPs->UseInstance;
|
|
|
|
+ if(fb->WarnFileExists){
|
|
|
|
+ char path[2048]; la_FileBrowserGetFullPath(fb, path);
|
|
|
|
+ if(access(path, F_OK)==0){
|
|
|
|
+ laEnableYesNoPanel(a,0,"File exists","Selected file already exists. Overwrite the file?",e->x-LA_RH,e->y-LA_RH,200,e);
|
|
|
|
+ fb->StatusWaitingWarning=1; return LA_RUNNING;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ laConfirmInt(a, 0, LA_CONFIRM_OK); return LA_FINISHED_PASS;
|
|
|
|
+ }
|
|
|
|
+ return LA_FINISHED_PASS;
|
|
|
|
+}
|
|
|
|
+int OPMOD_FileBrowserConfirm(laOperator *a, laEvent *e){
|
|
|
|
+ laFileBrowser* fb=a->This->LastPs->UseInstance;
|
|
|
|
+ if (a->ConfirmData){
|
|
|
|
+ if (a->ConfirmData->Mode == LA_CONFIRM_CANCEL){
|
|
|
|
+ if(fb->StatusWaitingWarning){ fb->StatusWaitingWarning=0; return LA_FINISHED; }
|
|
|
|
+ }
|
|
|
|
+ if (a->ConfirmData->Mode == LA_CONFIRM_OK){
|
|
|
|
+ laConfirmInt(a, 0, LA_CONFIRM_OK); return LA_FINISHED_PASS;
|
|
|
|
+ }
|
|
|
|
+ return LA_FINISHED;
|
|
|
|
+ }
|
|
|
|
+ return LA_RUNNING;
|
|
|
|
+}
|
|
|
|
|
|
int OPEXT_UDFOperation(laOperator *a, laEvent *e){
|
|
int OPEXT_UDFOperation(laOperator *a, laEvent *e){
|
|
laUDFPreviewExtra *upe = a->CustomData;
|
|
laUDFPreviewExtra *upe = a->CustomData;
|
|
@@ -1925,6 +1959,7 @@ void la_RegisterBuiltinOperators(){
|
|
laCreateOperatorType("LA_view_hyper_data", "View Hyper Data", "Show Properties Of Specific Data Block", OPCHK_IsHyper, 0, 0, OPINV_ViewHyperData, 0, L'🛈', LA_ACTUATOR_SYSTEM);
|
|
laCreateOperatorType("LA_view_hyper_data", "View Hyper Data", "Show Properties Of Specific Data Block", OPCHK_IsHyper, 0, 0, OPINV_ViewHyperData, 0, L'🛈', LA_ACTUATOR_SYSTEM);
|
|
|
|
|
|
laCreateOperatorType("LA_file_dialog_up", "Up", "Select Upper Folder Level", OPCHK_IsFileBrowser, 0, 0, OPINV_FileBrowserUpLevel, 0, L'🢰', LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
|
|
laCreateOperatorType("LA_file_dialog_up", "Up", "Select Upper Folder Level", OPCHK_IsFileBrowser, 0, 0, OPINV_FileBrowserUpLevel, 0, L'🢰', LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
|
|
|
|
+ laCreateOperatorType("LA_file_dialog_confirm", "Confirm", "Confirm selection", OPCHK_FileBrowserCanConfirm, 0, 0, OPINV_FileBrowserConfirm, OPMOD_FileBrowserConfirm, L'✔', LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
|
|
at = laCreateOperatorType("LA_file_dialog", "File Dialog", "Do File Operations", 0, 0, OPEXT_FileBrowser, OPINV_FileBrowser, OPMOD_FileBrowser, L'🗐', LA_ACTUATOR_SYSTEM);
|
|
at = laCreateOperatorType("LA_file_dialog", "File Dialog", "Do File Operations", 0, 0, OPEXT_FileBrowser, OPINV_FileBrowser, OPMOD_FileBrowser, L'🗐', LA_ACTUATOR_SYSTEM);
|
|
pc = laDefineOperatorProps(at, 2);
|
|
pc = laDefineOperatorProps(at, 2);
|
|
at->UiDefine = laui_FileBrowserFileList;
|
|
at->UiDefine = laui_FileBrowserFileList;
|
|
@@ -1939,6 +1974,7 @@ void la_RegisterBuiltinOperators(){
|
|
laAddEnumItemAs(ep, "folder", "Folder", "Folder", LA_FILE_SELECT_FOLDER, L'🖹');
|
|
laAddEnumItemAs(ep, "folder", "Folder", "Folder", LA_FILE_SELECT_FOLDER, L'🖹');
|
|
}
|
|
}
|
|
laAddOperatorProperty(pc, "folder_up", "Up", "Select Upper Folder Level In File Browsers", "LA_file_dialog_up", L'🢰', 0);
|
|
laAddOperatorProperty(pc, "folder_up", "Up", "Select Upper Folder Level In File Browsers", "LA_file_dialog_up", L'🢰', 0);
|
|
|
|
+ laAddOperatorProperty(pc, "confirm", "Confirm", "Confirm selection", "LA_file_dialog_confirm", L'✔', 0);
|
|
p = laAddPropertyContainer("disk_item", "Disk Item", "A Logical Drive (In Windows)", 0, laui_FileBrowserDiskItem, 0, 0, 0, 0);{
|
|
p = laAddPropertyContainer("disk_item", "Disk Item", "A Logical Drive (In Windows)", 0, laui_FileBrowserDiskItem, 0, 0, 0, 0);{
|
|
laAddStringProperty(p, "id", "ID", "Disk Identifier", 0, 0, 0, 0, 0, 0, 0, laget_FileBrowserDiskID, 0, 0, 0);
|
|
laAddStringProperty(p, "id", "ID", "Disk Identifier", 0, 0, 0, 0, 0, 0, 0, laget_FileBrowserDiskID, 0, 0, 0);
|
|
laAddFloatProperty(p, "total_gb", "Total", "Disk Total Compacity In Gigabytes", 0, 0, "GB", 0, 0, 0, 0, 0, offsetof(laDiskItem, Total_GB), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,LA_READ_ONLY);
|
|
laAddFloatProperty(p, "total_gb", "Total", "Disk Total Compacity In Gigabytes", 0, 0, "GB", 0, 0, 0, 0, 0, offsetof(laDiskItem, Total_GB), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,LA_READ_ONLY);
|