1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572 |
- /*
- * LaGUI: A graphical application framework.
- * Copyright (C) 2022-2023 Wu Yiming
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- #include "../la_5.h"
- extern LA MAIN;
- extern struct _tnsMain *T;
- void la_PanelActiviatorParser(laStringSplitor *ss, uint32_t *IconID, char *DisplayString){
- char *StrArg;
- if (ss->parts.pFirst){
- if (StrArg = strGetArgumentString(ss, "text")){
- strCopyFull(DisplayString, StrArg);
- }else if (StrArg = strGetArgumentString(ss, "panel_id")){
- laUiTemplate* uit = laFindUiTemplate(StrArg);
- strCopyFull(DisplayString, transLate("Show "));
- strAppend(DisplayString, uit->Title->Ptr);
- }
- }else{
- strCopyFull(DisplayString, transLate("Activate A Panel"));
- }
- }
- void la_DefaultOperatorParser(laStringSplitor *ss, uint32_t *IconID, char *DisplayString){
- char *StrArg;
- laStringPart *sp;
- if (ss && ss->parts.pFirst){
- if (StrArg = strGetArgumentString(ss, "text")){
- strCopyFull(DisplayString, StrArg);
- }
- if (StrArg = strGetArgumentString(ss, "icon")){
- int adv=0; *IconID = laToUnicode(StrArg, &adv);
- }
- }
- }
- laProp *la_PropLookup(laListHandle *lst, char *ID);
- void la_EnsurePanelSnapping(laPanel *p, int CW, int CH);
- void la_RecalcBlockRecursive(laBlock *b, int X, int Y, int W, int H);
- void la_ConditionNodeFreeRecursive(laUiConditionNode *ucn);
- int OPMOD_FinishOnData(laOperator* a, laEvent* e){
- if(a->ConfirmData){
- return LA_FINISHED_PASS;
- }
- return LA_RUNNING;
- }
- void OPEXT_FreeUserData(laOperator* a, int mark_unused){
- if(a->CustomData) memFree(a->CustomData);
- }
- int OPCHK_AlwaysTrue(laPropPack *pp, laStringSplitor *ss){
- return 1;
- }
- int OPINV_DoNothing(laOperator *a, laEvent *e){
- return LA_FINISHED;
- }
- int OPINV_PureYesNo(laOperator *a, laEvent *e){
- laEnableYesNoPanel(a, 0, "Please Consider:", "Are You Sure?", 80, 80, 250, e);
- return LA_FINISHED;
- }
- #define DEFINE_FORMAT(str, type) \
- if (!strcmp(format, str)) return type;
- int la_DetectFileItemType(char* format){
- for(laExtensionType* et=MAIN.ExtraExtensions.pFirst;et;et=et->Item.pNext){ DEFINE_FORMAT(et->Extension, et->FileType); }
- DEFINE_FORMAT("lasdexchange", LA_FILETYPE_LASDEXCHANGE);
- DEFINE_FORMAT("odt", LA_FILETYPE_DOCUMENT);
- DEFINE_FORMAT("ods", LA_FILETYPE_DOCUMENT);
- DEFINE_FORMAT("odp", LA_FILETYPE_DOCUMENT);
- DEFINE_FORMAT("txt", LA_FILETYPE_DOCUMENT);
- DEFINE_FORMAT("c", LA_FILETYPE_DOCUMENT);
- DEFINE_FORMAT("cpp", LA_FILETYPE_DOCUMENT);
- DEFINE_FORMAT("cxx", LA_FILETYPE_DOCUMENT);
- DEFINE_FORMAT("cs", LA_FILETYPE_DOCUMENT);
- DEFINE_FORMAT("pas", LA_FILETYPE_DOCUMENT);
- DEFINE_FORMAT("h", LA_FILETYPE_DOCUMENT);
- DEFINE_FORMAT("hpp", LA_FILETYPE_DOCUMENT);
- DEFINE_FORMAT("hxx", LA_FILETYPE_DOCUMENT);
- DEFINE_FORMAT("inl", LA_FILETYPE_DOCUMENT);
- DEFINE_FORMAT("doc", LA_FILETYPE_DOCUMENT);
- DEFINE_FORMAT("docx", LA_FILETYPE_DOCUMENT);
- DEFINE_FORMAT("xls", LA_FILETYPE_DOCUMENT);
- DEFINE_FORMAT("xlsx", LA_FILETYPE_DOCUMENT);
- DEFINE_FORMAT("ppt", LA_FILETYPE_DOCUMENT);
- DEFINE_FORMAT("pptx", LA_FILETYPE_DOCUMENT);
- DEFINE_FORMAT("rtf", LA_FILETYPE_DOCUMENT);
- DEFINE_FORMAT("md", LA_FILETYPE_DOCUMENT);
- DEFINE_FORMAT("jpg", LA_FILETYPE_IMAGE);
- DEFINE_FORMAT("jpeg", LA_FILETYPE_IMAGE);
- DEFINE_FORMAT("png", LA_FILETYPE_IMAGE);
- DEFINE_FORMAT("tga", LA_FILETYPE_IMAGE);
- DEFINE_FORMAT("bmp", LA_FILETYPE_IMAGE);
- DEFINE_FORMAT("exr", LA_FILETYPE_IMAGE);
- DEFINE_FORMAT("psd", LA_FILETYPE_IMAGE);
- DEFINE_FORMAT("kra", LA_FILETYPE_IMAGE);
- DEFINE_FORMAT("dng", LA_FILETYPE_IMAGE);
- DEFINE_FORMAT("cr2", LA_FILETYPE_IMAGE);
- DEFINE_FORMAT("dds", LA_FILETYPE_IMAGE);
- DEFINE_FORMAT("mp3", LA_FILETYPE_AUDIO);
- DEFINE_FORMAT("wav", LA_FILETYPE_AUDIO);
- DEFINE_FORMAT("ape", LA_FILETYPE_AUDIO);
- DEFINE_FORMAT("flac", LA_FILETYPE_AUDIO);
- DEFINE_FORMAT("cue", LA_FILETYPE_AUDIO);
- DEFINE_FORMAT("wma", LA_FILETYPE_AUDIO);
- DEFINE_FORMAT("aac", LA_FILETYPE_AUDIO);
- DEFINE_FORMAT("m4a", LA_FILETYPE_AUDIO);
- DEFINE_FORMAT("ogg", LA_FILETYPE_AUDIO);
- DEFINE_FORMAT("mp4", LA_FILETYPE_VIDEO);
- DEFINE_FORMAT("mov", LA_FILETYPE_VIDEO);
- DEFINE_FORMAT("avi", LA_FILETYPE_VIDEO);
- DEFINE_FORMAT("avchd", LA_FILETYPE_VIDEO);
- DEFINE_FORMAT("mkv", LA_FILETYPE_VIDEO);
- DEFINE_FORMAT("qt", LA_FILETYPE_VIDEO);
- DEFINE_FORMAT("flv", LA_FILETYPE_VIDEO);
- DEFINE_FORMAT("zip", LA_FILETYPE_COMPRESSED);
- DEFINE_FORMAT("rar", LA_FILETYPE_COMPRESSED);
- DEFINE_FORMAT("gz", LA_FILETYPE_COMPRESSED);
- DEFINE_FORMAT("bz", LA_FILETYPE_COMPRESSED);
- DEFINE_FORMAT("7z", LA_FILETYPE_COMPRESSED);
- DEFINE_FORMAT("iso", LA_FILETYPE_COMPRESSED);
- DEFINE_FORMAT("dmg", LA_FILETYPE_COMPRESSED);
- DEFINE_FORMAT("ttf", LA_FILETYPE_FONT);
- DEFINE_FORMAT("otf", LA_FILETYPE_FONT);
- DEFINE_FORMAT("woff", LA_FILETYPE_FONT);
- DEFINE_FORMAT("svg", LA_FILETYPE_VECTOR);
- DEFINE_FORMAT("dwg", LA_FILETYPE_VECTOR);
- DEFINE_FORMAT("dxf", LA_FILETYPE_VECTOR);
- DEFINE_FORMAT("cdr", LA_FILETYPE_VECTOR);
- DEFINE_FORMAT("htm", LA_FILETYPE_WEBPAGE);
- DEFINE_FORMAT("html", LA_FILETYPE_WEBPAGE);
- DEFINE_FORMAT("xhtml", LA_FILETYPE_WEBPAGE);
- DEFINE_FORMAT("xml", LA_FILETYPE_META);
- DEFINE_FORMAT("dat", LA_FILETYPE_META);
- DEFINE_FORMAT("json", LA_FILETYPE_META);
- DEFINE_FORMAT("blend", LA_FILETYPE_BLEND);
- DEFINE_FORMAT("pdf", LA_FILETYPE_PDF);
- DEFINE_FORMAT("exe", LA_FILETYPE_EXEC);
- DEFINE_FORMAT("dll", LA_FILETYPE_SYS);
- DEFINE_FORMAT("sys", LA_FILETYPE_SYS);
- return 0;
- }
- int la_AcceptFileFormat(laFileBrowser* fb, char* format){
- if(!format || !format[0]) return 1;
- char buf[2048];
- if(fb->FilterType){
- for(laExtensionType* et=MAIN.ExtraExtensions.pFirst;et;et=et->Item.pNext){
- if(et->FileType==fb->FilterType && strSame(format, et->Extension)) return 1;
- if(fb->ShowBackups){
- sprintf(buf,"%s~",et->Extension);
- if(strSame(format,buf)) return 1;
- }
- }
- return 0;
- }
- if(!fb->ss_filter_extensions) return 1;
- for(laStringPart* sp=fb->ss_filter_extensions->parts.pFirst;sp;sp=sp->Item.pNext){
- if(!strcmp(sp->Content, format)) return 1;
- if(fb->ShowBackups){
- sprintf(buf,"%s~",sp->Content);
- if(strSame(format,buf)) return 1;
- }
- }
- return 0;
- }
- typedef int (*FileSortCompF)(laFileItem* f1,laFileItem* f2);
- #if defined (_WIN32) || defined (LAGUI_ANDROID)
- #define strverscmp strcmp
- #endif
- int la_filecompname(laFileItem* f1,laFileItem* f2){ return strverscmp(f2->Name, f1->Name); }
- int la_filecompnamerev(laFileItem* f1,laFileItem* f2){ return strverscmp(f1->Name, f2->Name); }
- int la_filecomptime(laFileItem* f1,laFileItem* f2){ return f1->Timestamp - f2->Timestamp; }
- int la_filecomptimerev(laFileItem* f1,laFileItem* f2){ return f2->Timestamp - f1->Timestamp; }
- int la_filecompsize(laFileItem* f1,laFileItem* f2){ return f1->Size - f2->Size; }
- int la_filecompsizerev(laFileItem* f1,laFileItem* f2){ return f2->Size - f1->Size; }
- #ifdef _WIN32
- #undef strverscmp
- #endif
- void la_SortFiles(laFileBrowser* fb, laListHandle* files){
- laListHandle tmp={0}; laFileItem* fi;
- FileSortCompF comp = 0;
- switch(fb->SortBy){
- case LA_FILE_SORT_NAME: default: comp=la_filecompname; break;
- case LA_FILE_SORT_NAME_REV: comp=la_filecompnamerev; break;
- case LA_FILE_SORT_TIME: comp=la_filecomptime; break;
- case LA_FILE_SORT_TIME_REV: comp=la_filecomptimerev; break;
- case LA_FILE_SORT_SIZE: comp=la_filecompsize; break;
- case LA_FILE_SORT_SIZE_REV: comp=la_filecompsizerev; break;
- }
- while(fi=lstPopItem(files)){ int inserted=0;
- for(laFileItem* fii=tmp.pFirst;fii;fii=fii->Hyper.pNext){
- int a=comp(fii,fi);
- if(a<0){ lstInsertItemBefore(&tmp,fi,fii); inserted=1; break; }
- }
- if(!inserted){ lstAppendItem(&tmp, fi); }
- }
- files->pFirst=tmp.pFirst; files->pLast=tmp.pLast;
- }
- void la_FileBrowserRebuildList(laFileBrowser *fb){
- laFileItem *fi = 0;
- laDiskItem *dl = 0;
- laListHandle Files = {0};
- char Lookup[2048]={0};
- char Final[2048]={0};
- char DiskLabels[256] = {0};
- char *pd = DiskLabels;
- int len = strlen(fb->Path);
- int NumDisks = 0;
- u64bit FreeAvailable = 0;
- u64bit FreeSpace_UNUSED = 0;
- u64bit TotalSpace = 0;
- real Ratio = 0;
- #ifdef __linux__
- #ifdef LAGUI_ANDROID
- #define versionsort alphasort
- #endif
- if (fb->Path[len - 1] != U'/') strcat(fb->Path, "/");
- struct dirent **NameList=0;
- int NumFiles=scandir(fb->Path,&NameList,0,versionsort);
- while (fi = lstPopItem(&fb->FileList)) memFree(fi);
- for(int i=0;i<NumFiles;i++){
- struct dirent* d = NameList[i];
- if(!strcmp(d->d_name, ".") || !strcmp(d->d_name, "..")){continue;}
- if(fb->FilterName[0] && !strcasestr(d->d_name,fb->FilterName)){continue;}
- struct stat s;
- sprintf(Final, "%s%s",fb->Path,d->d_name);
- stat(Final, &s);
- if (S_ISDIR(s.st_mode)){
- fi = memAcquireSimple(sizeof(laFileItem));
- strcpy(fi->Name, d->d_name);
- fi->IsFolder = 1;
- fi->Type = LA_FILETYPE_FOLDER;
- lstAppendItem(&fb->FileList, fi);
- }elif (!fb->SelectFolder){
- char *format = strGetLastSegment(d->d_name, '.');
- if(!la_AcceptFileFormat(fb,format)){ continue; }
- fi = memAcquireSimple(sizeof(laFileItem));
- strcpy(fi->Name, d->d_name);
- fi->Size = s.st_size;
- fi->Type = la_DetectFileItemType(format);
- fi->Timestamp = s.st_ctime;
- struct tm *t = localtime(&s.st_ctime);
- fi->TimeModified.Year = t->tm_year+1900;
- fi->TimeModified.Month = t->tm_mon+1;;
- fi->TimeModified.Day = t->tm_mday;
- fi->TimeModified.Hour = t->tm_hour;
- fi->TimeModified.Minute = t->tm_min;
- fi->TimeModified.Second = t->tm_sec;
- lstAppendItem(&Files, fi);
- //lstAppendItem(&fb->FileList, fi);
- }
- }
- for (int i = 0; i < NumFiles; i++) { free(NameList[i]); } free(NameList);
- #endif
- #ifdef _WIN32
- WIN32_FIND_DATA FindFileData;
- HANDLE hFind;
- SYSTEMTIME stUTC, stLocal;
- strCopyFull(Lookup, fb->Path);
- if (Lookup[len - 1] != U'\\') strcat(Lookup, "\\*.*"); else strcat(Lookup, "*.*");
- hFind = FindFirstFile(Lookup, &FindFileData);
- while (fi = lstPopItem(&fb->FileList)) memFree(fi);
- if (hFind == INVALID_HANDLE_VALUE){ return; }
- char buf[1024]; if (fb->FilterName[0]) { strToLower(fb->FilterName); }
- while (1) {
- if (fb->FilterName[0]) {
- strcpy(buf, FindFileData.cFileName); strToLower(buf);
- if (!strstr(buf, fb->FilterName)) { goto findnext; }
- }
- if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
- if (FindFileData.cFileName[0] != '.') {
- fi = memAcquireSimple(sizeof(laFileItem));
- strcpy(fi->Name, FindFileData.cFileName);
- fi->IsFolder = 1;
- fi->Type = LA_FILETYPE_FOLDER;
- lstAppendItem(&fb->FileList, fi);
- }
- }elif(!fb->SelectFolder) {
- fi = memAcquireSimple(sizeof(laFileItem));
- strCopyFull(fi->Name, FindFileData.cFileName);
- fi->Size = FindFileData.nFileSizeLow;
- fi->Type = la_DetectFileItemType(fi);
- FileTimeToSystemTime(&(FindFileData.ftLastWriteTime), &stUTC);
- SystemTimeToTzSpecificLocalTime(NULL, &stUTC, &stLocal);
- fi->Timestamp = (uint64_t)FindFileData.ftLastWriteTime.dwHighDateTime|((uint64_t)(FindFileData.ftLastWriteTime.dwLowDateTime)<<32);
- fi->TimeModified.Year = stLocal.wYear;
- fi->TimeModified.Month = stLocal.wMonth;
- fi->TimeModified.Day = stLocal.wDay;
- fi->TimeModified.Hour = stLocal.wHour;
- fi->TimeModified.Minute = stLocal.wMinute;
- fi->TimeModified.Second = stLocal.wSecond;
- lstAppendItem(&Files, fi);
- //lstAppendItem(&fb->FileList, fi);
- }
- findnext:
- if (!FindNextFile(hFind, &FindFileData))
- break;
- }
- #endif
- la_SortFiles(fb, &Files);
- lstCombineLists(&fb->FileList, &Files);
- while (dl = lstPopItem(&fb->Disks)) memFree(dl);
- #ifdef _WIN32
- NumDisks = GetLogicalDriveStrings(256, DiskLabels) / 4;
- while (*pd){
- char Name[3] = "*:";
- Name[0] = *pd;
- if (GetDiskFreeSpaceEx(Name, &FreeAvailable, &TotalSpace, &FreeSpace_UNUSED)){
- dl = memAcquire(sizeof(laDiskItem));
- dl->ID = *pd;
- dl->Total_GB = (real)TotalSpace / 1073741824.0f; //B->GB
- dl->Free_GB = (real)FreeAvailable / 1073741824.0f; //B->GB
- if (Name[0] == fb->Path[0])
- fb->RootDisk = dl;
- lstAppendItem(&fb->Disks, dl);
- }
- pd += 4;
- }
- #endif
- fb->Active = 0;
- }
- laFileBrowser *la_FileBrowserInit(laOperator *a){
- laFileBrowser *fb = memAcquire(sizeof(laFileBrowser));
- char* arg=0;
- #ifdef LAGUI_ANDROID
- strcpy(fb->Path, MAIN.ExternalDataPath);
- laBookmarkedFolder* bf=memAcquireSimple(sizeof(laBookmarkedFolder));
- strcpy(bf->Path,fb->Path); strcpy(bf->Name,strGetLastSegment(fb->Path,"External")); lstAppendItem(&fb->Bookmarks,bf);
- bf=memAcquireSimple(sizeof(laBookmarkedFolder));
- strcpy(bf->Path,MAIN.InternalDataPath); strcpy(bf->Name,"Internal"); lstAppendItem(&fb->Bookmarks,bf);
- #else
- strcpy(fb->Path, SSTR(MAIN.WorkingDirectory));
- #endif
- if (strArgumentMatch(a->ExtraInstructionsP, "select", "folder")){ fb->SelectFolder = LA_FILE_SELECT_FOLDER; }
- if (strArgumentMatch(a->ExtraInstructionsP, "warn_file_exists", "true")){ fb->WarnFileExists = 1; }
- if ((arg=strGetArgumentString(a->ExtraInstructionsP, "filter_extensions"))){ fb->ss_filter_extensions=strSplitPath(arg,','); }
- if ((arg=strGetArgumentString(a->ExtraInstructionsP, "use_extension"))){ strcpy(fb->UseExtension, arg); }
- if ((arg=strGetArgumentString(a->ExtraInstructionsP, "filter_type"))){ sscanf(arg,"%d",&fb->FilterType); }
- if ((arg=strGetArgumentString(a->ExtraInstructionsP, "use_type"))){ sscanf(arg,"%d",&fb->UseType); }
- #ifdef LA_LINUX
- char BookmarkPath[1024];
- strcat(strcpy(BookmarkPath, getenv("HOME")), "/.config/gtk-3.0/bookmarks");
- FILE* f=fopen(BookmarkPath, "r");
- if(f){ char entry[1024]={0};
- while(fgets(entry,1024,f)){ laBookmarkedFolder* bf=memAcquireSimple(sizeof(laBookmarkedFolder));
- entry[strlen(entry)-1]=0;
- strcpy(bf->Path,&entry[7]);
- strcpy(bf->Name,strGetLastSegment(&entry[7],'/')); lstAppendItem(&fb->Bookmarks,bf);
- }
- fclose(f);
- }
- #endif
- la_FileBrowserRebuildList(fb);
- fb->FileName[0] = 0;
- memAssignRef(fb, &fb->Thumbnail, tnsNewImage(0));
- fb->ShowThumbnail = 1;
- return fb;
- }
- void la_FileBrowserGetFullPath(laFileBrowser *fb,char* buf){
- buf[0]=0; int plen;
- if (!fb->SelectFolder && fb->FileName[0] == U'\0') return;
- plen = strlen(fb->Path);
- if (fb->Path[plen - 1] != LA_PATH_SEP) strcat(fb->Path, LA_PATH_SEPSTR);
- strCopyFull(buf, fb->Path);
- strcat(buf, fb->FileName);
- }
- void la_FileBrowserRefreshThumbnail(laFileBrowser* fb){
- if(MAIN.ThumbnailProp && fb->Active && fb->Active->Type==LA_FILETYPE_UDF){
- char* prop=SSTR(MAIN.ThumbnailProp); if(prop[0]){
- char fbuf[2048];la_FileBrowserGetFullPath(fb,fbuf);
- FILE* fpudf=fopen(fbuf,"rb"); if(fpudf){
- void* data=0; size_t size=0;
- if(laExtractQuickRaw(fpudf,prop,&data,&size)){
- tnsRefreshImage(fb->Thumbnail,data);
- fclose(fpudf); return;
- }
- fclose(fpudf);
- }
- }
- }
- #ifdef LA_LINUX
- char buf[2048]="file://"; char md5[128];
- la_FileBrowserGetFullPath(fb,buf+strlen(buf));
- md5String(buf,md5); toHexString(md5,fb->MD5);
- sprintf(buf,"%s/.cache/thumbnails/normal/%s.png", getenv("HOME"),fb->MD5);
- FILE *fp=fopen(buf,"rb"); char* data=0;
- if(fp){
- fseek(fp, 0, SEEK_END); u64bit SeekEnd = ftell(fp); fseek(fp, 0, SEEK_SET);
- data = calloc(1, SeekEnd); fread(data, SeekEnd, 1, fp);
- tnsRefreshImage(fb->Thumbnail,data);
- }else{
- tnsRefreshImage(fb->Thumbnail,0);
- }
- #endif
- }
- void laset_FileBrowserSelectFile(laFileBrowser *fb, laFileItem *fi, int State){
- int len;
- if (fb->Active == fi){
- if (fi->IsFolder){
- len = strlen(fb->Path);
- if (fb->Path[len - 1] != LA_PATH_SEP) strcat(fb->Path, LA_PATH_SEPSTR);
- strcat(fb->Path, fi->Name);
- la_FileBrowserRebuildList(fb);
- fb->FileName[0] = 0; fb->FilterName[0]=0;
- laRecalcCurrentPanelImmediate();
- }
- }else{
- if (!fi->IsFolder){
- strCopyFull(fb->FileName, fi->Name);
- }
- fb->Active = fi;
- la_FileBrowserRefreshThumbnail(fb);
- }
- }
- int la_FileBrowserConfirm(laOperator *a, laFileBrowser *fb){
- char buf[2048];
- la_FileBrowserGetFullPath(fb,buf);
- laConfirmString(a, buf, LA_CONFIRM_OK);
- return 1;
- }
- void *laget_FileBrowserFirstFile(laFileBrowser *fb, void* unused){
- return fb->FileList.pFirst;
- }
- void *laget_FileBrowserActiveFile(laFileBrowser *fb){
- return fb->Active;
- }
- void laget_FileBrowserDiskID(laDiskItem *di, char *result){
- result[0] = di->ID;
- result[1] = U':';
- result[2] = LA_PATH_SEP;
- result[3] = U'\0';
- }
- void *laset_FileBrowserActiveDisk(laFileBrowser *fb, laDiskItem *di, int UNUSED_State){
- fb->RootDisk = di;
- laget_FileBrowserDiskID(di, fb->Path);
- la_FileBrowserRebuildList(fb);
- fb->FileName[0] = 0;
- }
- void laset_FileBrowserPath(laFileBrowser *fb, char *content){
- if(!strSame(content, fb->Path)){
- strCopyFull(fb->Path, content); la_FileBrowserRebuildList(fb); fb->FileName[0] = 0; laRecalcCurrentPanel();
- }
- }
- void *laset_FileBrowserBookmark(laFileBrowser *fb, laBookmarkedFolder *bf){
- strcpy(fb->Path,bf->Path); la_FileBrowserRebuildList(fb); fb->FileName[0] = 0;
- }
- void laset_FileBrowserFileName(laFileBrowser *fb, char *content){
- strCopyFull(fb->FileName, content); int file_okay=0;
- char* ext=strGetLastSegment(fb->FileName,'.');
- if(fb->UseExtension[0] && strcmp(ext,fb->UseExtension)){ strcat(fb->FileName,"."); strcat(fb->FileName,fb->UseExtension); }
- else if(fb->UseType){ int file_okay=0; laExtensionType* FirstET=0;
- for(laExtensionType*et=MAIN.ExtraExtensions.pFirst;et;et=et->Item.pNext){
- if((!FirstET) && et->FileType==fb->UseType) FirstET=et;
- if(et->FileType==fb->UseType && strSame(ext,et->Extension)){ file_okay=1; break; }
- }
- if((!file_okay) && FirstET){ strcat(fb->FileName,"."); strcat(fb->FileName,FirstET->Extension); }
- }
- la_FileBrowserRebuildList(fb);
- laRecalcCurrentPanel();
- }
- void laset_FileBrowserFilterName(laFileBrowser *fb, char *content){
- strCopyFull(fb->FilterName, content); int file_okay=0;
- la_FileBrowserRebuildList(fb); laRecalcCurrentPanel();
- }
- void* laget_FileBrowserAcceptedExtensionsFrist(laFileBrowser* fb, laPropIterator* pi){
- if(!fb->UseType){ return 0; }
- for(laExtensionType*et=MAIN.ExtraExtensions.pFirst;et;et=et->Item.pNext){
- if(et->FileType==fb->UseType){ return et; }
- }
- return 0;
- }
- void* laget_FileBrowserAcceptedExtensionsNext(laExtensionType* et, laPropIterator* pi){
- for(laExtensionType*iet=et->Item.pNext;iet;iet=iet->Item.pNext){
- if(et->FileType==iet->FileType){ return iet; }
- }
- return 0;
- }
- void* laset_FileBrowserExtension(laFileBrowser* fb, laExtensionType* et){
- if(fb->UseType && fb->FileName[0] && et){ char* ext=strGetLastSegment(fb->FileName,'.');
- if(!ext){ sprintf(fb->FileName,".%s",ext); }
- elif(strcmp(et->Extension,ext)){ sprintf(ext,"%s",et->Extension); }
- la_FileBrowserRebuildList(fb); laRecalcCurrentPanel();
- }
- return 0;
- }
- void laset_FileBrowserShowBackups(laFileBrowser* fb, int show){
- fb->ShowBackups = show; la_FileBrowserRebuildList(fb); laRecalcCurrentPanel();
- }
- void laset_FileBrowserShowThumbnail(laFileBrowser* fb, int show){
- fb->ShowThumbnail = show; if(show){ la_FileBrowserRefreshThumbnail(fb); } laRecalcCurrentPanel();
- }
- void laset_FileBrowserSortName(laFileBrowser* fb, int s){
- if(fb->SortBy==LA_FILE_SORT_NAME) fb->SortBy=LA_FILE_SORT_NAME_REV;
- else fb->SortBy=LA_FILE_SORT_NAME; la_FileBrowserRebuildList(fb); laRecalcCurrentPanel();
- }
- int laget_FileBrowserSortName(laFileBrowser*fb){
- if(fb->SortBy==LA_FILE_SORT_NAME) return 1; if(fb->SortBy==LA_FILE_SORT_NAME_REV) return 2; return 0;
- }
- void laset_FileBrowserSortTime(laFileBrowser* fb, int s){
- if(fb->SortBy==LA_FILE_SORT_TIME) fb->SortBy=LA_FILE_SORT_TIME_REV;
- else fb->SortBy=LA_FILE_SORT_TIME; la_FileBrowserRebuildList(fb); laRecalcCurrentPanel();
- }
- int laget_FileBrowserSortTime(laFileBrowser*fb){
- if(fb->SortBy==LA_FILE_SORT_TIME) return 1; if(fb->SortBy==LA_FILE_SORT_TIME_REV) return 2; return 0;
- }
- void laset_FileBrowserSortSize(laFileBrowser* fb, int s){
- if(fb->SortBy==LA_FILE_SORT_SIZE) fb->SortBy=LA_FILE_SORT_SIZE_REV;
- else fb->SortBy=LA_FILE_SORT_SIZE; la_FileBrowserRebuildList(fb); laRecalcCurrentPanel();
- }
- int laget_FileBrowserSortSize(laFileBrowser*fb){
- if(fb->SortBy==LA_FILE_SORT_SIZE) return 1; if(fb->SortBy==LA_FILE_SORT_SIZE_REV) return 2; return 0;
- }
- void laget_FileBrowserFileSizeString(laFileItem* fi, char* content, char** move){
- if(fi->Size >= (1<<30)){
- sprintf(content, "%.3lf GB", (real)fi->Size/(1<<30));
- }elif(fi->Size >= (1<<20)){
- sprintf(content, "%.3lf MB", (real)fi->Size/(1<<20));
- }elif(fi->Size >= (1<<10)){
- sprintf(content, "%.3lf KB", (real)fi->Size/(1<<10));
- }else{
- sprintf(content, "%d %s", fi->Size, transLate("Bytes"));
- }
- }
- void la_FileBrowserUpLevel(laFileBrowser *fb){
- char *p = fb->Path;
- char *LastP = 0;
- int Count = 0;
- for (p; *p; p++){
- if (*p && *p == LA_PATH_SEP && p[1]!=0){
- LastP = p;
- Count++;
- }
- }
- if (Count > 1) *LastP = 0;
- else if(LastP) *(LastP + 1) = 0;
- la_FileBrowserRebuildList(fb); fb->FileName[0] = 0;
- }
- void la_FileBrowserNewDirectory(laFileBrowser* fb,char* path){
- char* p=fb->Path;
- int len =strlen(p);
- #ifdef LA_LINUX
- if (p[len - 1] != U'/') strcat(p, "/");
- char usepath[2048]; sprintf(usepath,"%s%s",p,path);
- if(!mkdir(usepath,S_IRWXU | S_IRWXG | S_IRWXO)){
- strcpy(fb->Path,usepath);
- }
- #endif
- #ifdef _WIN32
- if (p[len - 1] != U'\\') strcat(p, "\\");
- //...
- #endif
- la_FileBrowserRebuildList(fb); laRecalcCurrentPanel();
- }
- int OPINV_FileBrowser(laOperator *a, laEvent *e){
- a->CustomData = la_FileBrowserInit(a);
- laEnableOperatorPanel(a, 0, LA_RH2, LA_RH2, 500, 500, 0, 0, 0, 0, LA_RH2, LA_RH2, LA_RH2, LA_RH2, e);
- return LA_RUNNING;
- }
- void OPEXT_FileBrowser(laOperator *a, int mark){
- laFileBrowser *fb = a->CustomData;
- void* f;
- while (f=lstPopItem(&fb->Disks)) memFree(f);
- while (f=lstPopItem(&fb->FileList)) memFree(f);
- while (f=lstPopItem(&fb->Bookmarks)) memFree(f);
- strDestroyStringSplitor(&fb->ss_filter_extensions);
- tnsRemoveImage(fb->Thumbnail);
- memFree(fb);
- }
- int OPMOD_FileBrowser(laOperator *a, laEvent *e){
- laFileBrowser *fb = a->CustomData;
- if (a->ConfirmData){
- if (a->ConfirmData->Mode == LA_CONFIRM_CANCEL){
- if(fb->StatusWaitingWarning){ fb->StatusWaitingWarning=0; return LA_RUNNING; }
- laConfirmSameDataIfAny(a); return LA_FINISHED_PASS;
- }
- if (a->ConfirmData->Mode == LA_CONFIRM_OK){
- la_FileBrowserConfirm(a, fb); return LA_FINISHED_PASS;
- }
- }
- if (e->type == LA_ESCAPE_DOWN){
- laConfirmInt(a, 0, LA_CONFIRM_CANCEL);
- return LA_FINISHED;
- }
- return LA_RUNNING;
- }
- int OPCHK_IsFileBrowser(laPropPack *This, laStringSplitor *ss){
- if (This && This->LastPs->p->SubProp == _LA_PROP_FILE_BROWSER) return 1;
- return 0;
- }
- int OPINV_FileBrowserUpLevel(laOperator *a, laEvent *e){
- if (a->This){
- la_FileBrowserUpLevel(a->This->EndInstance);
- laNotifyUsersPPPath(a->This, "path");
- laRecalcCurrentPanel();
- }
- return LA_FINISHED_PASS;
- }
- int OPINV_FileBrowserRefresh(laOperator *a, laEvent *e){
- if (a->This){
- la_FileBrowserRebuildList(a->This->EndInstance); laRecalcCurrentPanel();
- laNotifyUsersPPPath(a->This, "path");
- }
- return LA_FINISHED_PASS;
- }
- int OPINV_FileBrowserNewDirectory(laOperator *a, laEvent *e){
- if (a->This){
- laEnableOperatorPanel(a,a->This,e->x,e->y,200,200,400,400,0,0,0,0,0,0,e);
- return LA_RUNNING;
- }
- return LA_FINISHED;
- }
- int OPMOD_FileBrowserNewDirectory(laOperator *a, laEvent *e){
- laFileBrowser* fb=a->This->EndInstance;
- if (a->ConfirmData){
- if (a->ConfirmData->Mode == LA_CONFIRM_OK){
- la_FileBrowserNewDirectory(fb,fb->TempStr);
- }
- return LA_FINISHED;
- }
- return LA_RUNNING;
- }
- 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->EndInstance;
- if(fb->WarnFileExists){
- char path[2048]; la_FileBrowserGetFullPath(fb, path);
- #ifdef LA_LINUX
- if(access(path, F_OK)==0)
- #endif
- #ifdef _WIN32
- if (PathFileExists(path))
- #endif
- {
- 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->EndInstance;
- 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;
- }
- void laui_FileBrowserNewDirectory(laUiList *uil, laPropPack *This, laPropPack *Operator, laColumn *UNUSED, int context){
- laColumn* c=laFirstColumn(uil);
- laShowItem(uil,c,This,"temp_str");
- laUiItem* row=laBeginRow(uil,c,0,0);
- laShowSeparator(uil,c)->Expand=1;
- laShowItem(uil,c,0,"LA_confirm")->Flags|=LA_UI_FLAGS_HIGHLIGHT;
- laEndRow(uil,row);
- }
- void OPEXT_UDFOperation(laOperator *a, laEvent *e){
- laUDFPreviewExtra *upe = a->CustomData;
- memFree(upe);
- }
- int OPINV_UDFRead(laOperator *a, laEvent *e){
- laInvoke(a, "LA_file_dialog", e, 0, "filter_type=1;", 0);
- a->CustomData = memAcquireSimple(sizeof(laUDFPreviewExtra));
- laUDFPreviewExtra *upe = a->CustomData;
- if(strArgumentMatch(a->ExtraInstructionsP,"mode","append")){ upe->Append=1; }
- return LA_RUNNING;
- }
- int OPMOD_UDFRead(laOperator *a, laEvent *e){
- laUDFPreviewExtra *upe = a->CustomData;
- if (a->ConfirmData){
- if (a->ConfirmData->StrData){
- laManagedUDF* m;
- upe->UDF = laOpenUDF(a->ConfirmData->StrData, 1, 0, &m);
- if (upe->UDF){
- laFreeNewerDifferences();
- laFreeOlderDifferences(1);
- laExtractUDF(upe->UDF, m, upe->Append?LA_UDF_MODE_APPEND:LA_UDF_MODE_OVERWRITE);
- laCloseUDF(upe->UDF);
- laRecordEverythingAndPush(); laNotifyUsers("la.differences");
- return LA_FINISHED;
- }
- }
- return LA_FINISHED;
- }
- return LA_RUNNING;
- }
- int OPINV_UDFSaveInstance(laOperator *a, laEvent *e){
- laInvoke(a, "LA_file_dialog", e, 0, 0, 0);
- a->CustomData = memAcquireSimple(sizeof(laUDFPreviewExtra));
- return LA_RUNNING;
- }
- int OPMOD_UDFSaveInstance(laOperator *a, laEvent *e){
- laUDFPreviewExtra *upe = a->CustomData;
- laPropPack* pp=a->This; if(!pp||!pp->EndInstance) return LA_CANCELED;
- if (a->ConfirmData){
- if (a->ConfirmData->StrData){
- upe->UDF = laPrepareUDF(a->ConfirmData->StrData);
- if (upe->UDF){
- laWritePropP(upe->UDF, pp);
- laPackUDF(upe->UDF, 0, 0);
- return LA_FINISHED;
- }
- }
- }
- return LA_FINISHED;
- }
- void* laget_FirstManagedUDF(void* unused, void* unused_pi){ return MAIN.ManagedUDFs.pFirst; }
- void laset_ManagedSavePage(laManagedSaveExtra* mse, int p){
- mse->ShowPage=p;
- laRegisterModifications(0,0,0,0);
- }
- void OPEXT_ManagedSave(laOperator *a, laEvent *e){
- laManagedSaveExtra *upe = a->CustomData;
- memFree(upe);
- }
- int OPINV_ManagedSave(laOperator *a, laEvent *e){
- int OnExit=0;
- if(a->ExtraInstructionsP){
- if(strSame(strGetArgumentString(a->ExtraInstructionsP, "quiet"),"true")){
- int empty=0; laRegisterModifications(0,1,&empty,0);
- if(strSame(strGetArgumentString(a->ExtraInstructionsP, "ignore_unassigned"),"true")) empty=0;
- int modified_only=0; if(strSame(strGetArgumentString(a->ExtraInstructionsP, "modified_only"),"true")) modified_only=1;
- if(!empty){ laSaveManagedUDF(modified_only); return LA_FINISHED; }
- }
- if(strSame(strGetArgumentString(a->ExtraInstructionsP, "on_exit"),"true")){ OnExit=1; }
- }
- if(laOperatorExistsT(a->Type)) return LA_CANCELED;
- a->CustomData = memAcquire(sizeof(laManagedSaveExtra));
- laManagedSaveExtra* mse=a->CustomData;
- mse->OnExit=OnExit;
- mse->ShowPage = MAIN.ManagerDefaultView;
-
- laEnableOperatorPanel(a, 0, LA_RH2,LA_RH2,400,400,0,0,0,0,LA_RH2,LA_RH2,LA_RH2,LA_RH2,e);
- return LA_RUNNING;
- }
- int OPMOD_ManagedSave(laOperator *a, laEvent *e){
- laUDFPreviewExtra *upe = a->CustomData;
- if (a->ConfirmData){
- if(a->ConfirmData->Mode==LA_CONFIRM_CUSTOM_STRING && strSame(a->ConfirmData->StrData,"DISCARD_AND_QUIT")){
- return LA_OPERATOR_CALLS_SHUTOFF;
- }
- if(a->ConfirmData->Mode==LA_CONFIRM_CANCEL||a->ConfirmData->Mode==LA_CONFIRM_OK) return LA_FINISHED;
- return LA_RUNNING;
- }
- return LA_RUNNING;
- }
- int OPINV_ManagedSaveNewFile(laOperator *a, laEvent *e){
- if(MAIN.SetUDFPending) return LA_FINISHED;
- MAIN.SetUDFPending=1;
- a->CustomData = memAcquireSimple(sizeof(laUDFPreviewExtra));
- laInvoke(a, "LA_file_dialog", e, 0, "use_type=1;filter_type=1", 0);
- return LA_RUNNING;
- }
- int OPMOD_ManagedSaveNewFile(laOperator *a, laEvent *e){
- laUDFPreviewExtra *upe = a->CustomData;
- if (a->ConfirmData){
- if(a->ConfirmData->Mode==LA_CONFIRM_CANCEL){ MAIN.SetUDFPending=0; return LA_FINISHED; }
- if(a->ConfirmData->Mode==LA_CONFIRM_OK){
- if(a->ConfirmData->StrData){
- char* path=a->ConfirmData->StrData;
- if(la_FindManagedUDF(path)){
- laEnableMessagePanel(a, 0, "Duplicated files", "The file you chose already exists in the managed file list.",e->x,e->y,0,e);
- return LA_FINISHED;
- }
- laManagedUDF* m=MAIN.DummyManageUDF;
- m->udf = laPrepareUDF(path); strSafeSet(&m->BaseName, strGetLastSegment(path,LA_PATH_SEP));
- m->udf->Managed=1;
- la_MakeDummyManagedUDF();
- laNotifyUsers("la.managed_udfs"); laNotifyUsers("la.managed_props");
- }
- MAIN.SetUDFPending=0;
- return LA_FINISHED;
- }
- return LA_RUNNING;
- }
- return LA_RUNNING;
- }
- int OPINV_UDFManager(laOperator *a, laEvent *e){
- laRegisterModifications(0,0,0,0);
- laActivatePanel("LAUI_data_manager", e->x, e->y);
- return LA_FINISHED;
- }
- int OPINV_AddResourceFolder(laOperator *a, laEvent *e){
- laAddResourceFolder(0);
- laNotifyUsers("la.user_preferences.resource_folders");
- return LA_FINISHED;
- }
- int OPINV_RemoveResourceFolder(laOperator *a, laEvent *e){
- if(!a->This || !a->This->EndInstance) return LA_CANCELED;
- laResourceFolder* rf=a->This->EndInstance;
- laRemoveResourceFolder(rf);
- laRefreshUDFRegistries();
- laNotifyUsers("la.user_preferences.resource_folders");
- return LA_FINISHED;
- }
- int OPCHK_Undo(laPropPack *This, laStringSplitor *ss){
- laDiff* diff=MAIN.HeadDifference; if(!diff) return 0;
- diff=diff->Item.pPrev; if(!diff) return 0;
- }
- int OPCHK_Redo(laPropPack *This, laStringSplitor *ss){
- laDiff* diff=MAIN.HeadDifference; if(!diff) return 0;
- if(diff==MAIN.Differences.pLast) return 0;
- }
- int OPINV_Undo(laOperator *a, laEvent *e){
- laUndo();
- laPrintDBInstInfo();
- return LA_FINISHED;
- }
- int OPINV_Redo(laOperator *a, laEvent *e){
- laRedo();
- laPrintDBInstInfo();
- return LA_FINISHED;
- }
- int OPINV_UDFPropagate(laOperator *a, laEvent *e){
- laProp* p=a->This?a->This->LastPs->p:0; if(!p||p->PropertyType!=LA_PROP_SUB) return LA_FINISHED;
- void* instance=a->This->EndInstance; if(!instance) return LA_FINISHED;
- laPropContainer* pc=la_EnsureSubTarget(p,instance);
- int force=0;
- if(strSame(strGetArgumentString(a->ExtraInstructionsP,"force"),"true")){ force=1; }
- laPropagateUDF(pc, instance, force);
- laNotifyUsers("la.managed_props");
- return LA_FINISHED;
- }
- int OPINV_NewInputMapping(laOperator *a, laEvent *e){
- laNewInputMapping("New Mapping"); laNotifyUsers("la.input_mapping"); return LA_FINISHED;
- }
- int OPINV_RemoveInputMapping(laOperator *a, laEvent *e){
- if(!a->This || !a->This->EndInstance) return LA_CANCELED; laInputMapping* im=a->This->EndInstance;
- char* buf[256];sprintf(buf,"%s \"%s\".",transLate("Will remove input mapping"),SSTR(im->Name));
- laEnableYesNoPanel(0, 0, "Confirm?", buf, e->x, e->y, 200, e);
- return LA_RUNNING;
- }
- int OPINV_NewInputMappingEntry(laOperator *a, laEvent *e){
- if(!a->This || !a->This->EndInstance) return LA_CANCELED; laInputMapping* im=a->This->EndInstance;
- laNewInputMappingEntry(im,0,0,"a",0,"none"); laNotifyUsers("la.input_mapping"); return LA_FINISHED;
- }
- int OPINV_RemoveInputMappingEntry(laOperator *a, laEvent *e){
- if(!a->This || !a->This->EndInstance) return LA_CANCELED; laInputMappingEntry* ie=a->This->EndInstance;
- laEnableYesNoPanel(0, 0, "Confirm?", "Will remove this key map entry", e->x, e->y, 200, e);
- return LA_RUNNING;
- }
- int OPMOD_RemoveInputMapping(laOperator *a, laEvent *e){
- if(!a->This || !a->This->EndInstance) return LA_CANCELED; laInputMapping* im=a->This->EndInstance;
- if(a->ConfirmData){
- if(a->ConfirmData->Mode == LA_CONFIRM_OK){
- laRemoveInputMapping(im); laNotifyUsers("la.input_mapping");
- }
- return LA_FINISHED;
- }
- return LA_RUNNING;
- }
- int OPMOD_RemoveInputMappingEntry(laOperator *a, laEvent *e){
- if(!a->This || !a->This->EndInstance) return LA_CANCELED; laInputMappingEntry* ie=a->This->EndInstance;
- if(a->ConfirmData){
- if(a->ConfirmData->Mode == LA_CONFIRM_OK){
- laRemoveInputMappingEntry(ie->Parent,ie); laNotifyUsers("la.input_mapping");
- }
- return LA_FINISHED;
- }
- return LA_RUNNING;
- }
- int OPINV_InputMappingEntrySelectSignal(laOperator *a, laEvent *e){
- if(!a->This || !a->This->EndInstance) return LA_CANCELED; laInputMappingEntry* ime=a->This->EndInstance;
- laEnableOperatorPanel(a,a->This,e->x-LA_RH*5,e->y-LA_RH,LA_RH*10,LA_RH*10,LA_RH*30,LA_RH*30,0,0,0,0,0,0,e);
- return LA_RUNNING;
- }
- int OPMOD_InputMappingEntrySelectSignal(laOperator *a, laEvent *e){
- if(!a->This || !a->This->EndInstance) return LA_CANCELED; laInputMappingEntry* ime=a->This->EndInstance;
- if(a->ConfirmData){
- if(a->ConfirmData->Mode == LA_CONFIRM_DATA && a->ConfirmData->PointerData && strSame(a->ConfirmData->PointerType->Identifier,"la_custom_signal")){
- laCustomSignal* cs=a->ConfirmData->PointerData;
- ime->SignalValue = cs->Signal; strSafeSet(&ime->Signal,SSTR(cs->Name));
- laNotifyUsers("la.input_mapping");
- }
- return LA_FINISHED;
- }
- return LA_RUNNING;
- }
- void laui_InputMappingEntrySignalSelector(laUiList *uil, laPropPack *Base, laPropPack *OperatorInst, laColumn *ExtraColumns, int context){
- laColumn* c=laFirstColumn(uil);
- laUiItem* b=laBeginRow(uil,c,0,0);
- laShowLabel(uil,c,"🔍",0,0);
- laUiItem* ui=laShowItem(uil,c,0,"la.signal_filter");ui->Expand=1;ui->Flags|=LA_UI_FLAGS_IMMEDIATE_INPUT;
- laEndRow(uil,b);
- laUiItem* g=laMakeEmptyGroup(uil,c,0,0); laUiList* guil=g->Page; laColumn* gc=laFirstColumn(guil); guil->HeightCoeff=10;
- laShowItemFull(guil,gc,0,"la.filtered_signals",LA_WIDGET_COLLECTION,0,0,0)->Flags|=LA_UI_FLAGS_NO_DECAL;
- }
- STRUCTURE(laKeyDetectorData){
- int pad;
- int IsController;
- int Key;
- int SpecialKeyBit;
- int Button, Axis, Device;
- laSafeString* Str;
- };
- int OPEXT_InputMappingEntrySelectKey(laOperator* a,int exitmode){
- laKeyDetectorData* kdd=a->CustomData;
- strSafeDestroy(&kdd->Str);
- memFree(kdd);
- }
- int OPINV_InputMappingEntrySelectKey(laOperator *a, laEvent *e){
- if(!a->This || !a->This->EndInstance) return LA_CANCELED; laInputMappingEntry* ime=a->This->EndInstance;
- a->CustomData = memAcquire(sizeof(laKeyDetectorData));
- laEnableOperatorPanel(a,a->This,e->x-LA_RH*5,e->y-LA_RH,LA_RH*10,LA_RH*10,LA_RH*20,LA_RH*20,LA_RH*20,0,0,0,0,0,e);
- laOperatorModalOver(a);
- return LA_RUNNING;
- }
- int OPMOD_InputMappingEntrySelectKey(laOperator *a, laEvent *e){
- if(!a->This || !a->This->EndInstance) return LA_CANCELED; laInputMappingEntry* ime=a->This->EndInstance;
- laKeyDetectorData* kdd=a->CustomData; if(!kdd){ return LA_FINISHED; }
- char buf[64],*_next=buf;
- if(e->type == LA_KEY_DOWN){
- kdd->Key = e->key; la_InputMappingGetKeyName(kdd->Key,e->SpecialKeyBit,buf); strSafeSet(&kdd->Str,buf); kdd->IsController=0;
- laNotifyInstanceUsers(kdd); kdd->SpecialKeyBit=e->SpecialKeyBit;
- return LA_RUNNING;
- }elif(e->type == LA_EMPTY){
- if(MAIN.ControllerHasNewAxis){
- kdd->Axis = MAIN.LastControllerAxis; kdd->Device = MAIN.LastControllerAxisDevice; kdd->Button =-1; kdd->IsController=1;
- strSafeSet(&kdd->Str,laControllerIDGetAxisName(kdd->Device,kdd->Axis)); laNotifyInstanceUsers(kdd);
- }elif(MAIN.ControllerHasNewKey){
- kdd->Button = MAIN.LastControllerKey; kdd->Device = MAIN.LastControllerKeyDevice; kdd->Axis = -1; kdd->IsController=1;
- strSafeSet(&kdd->Str,laControllerIDGetButtonName(kdd->Device,kdd->Button)); laNotifyInstanceUsers(kdd);
- }
- }
- if(a->ConfirmData){
- if(a->ConfirmData->Mode == LA_CONFIRM_OK){
- strSafeSet(&ime->Key,SSTR(kdd->Str));
- if(kdd->IsController){ ime->DeviceType = LA_INPUT_DEVICE_JOYSTICK; ime->Axis=kdd->Axis; ime->Button=kdd->Button; ime->JoystickDevice = kdd->Device; }
- else{ ime->DeviceType = LA_INPUT_DEVICE_KEYBOARD; ime->KeyValue = kdd->Key; ime->SpecialKeyBits=kdd->SpecialKeyBit; }
- laNotifyInstanceUsers(ime);
- }
- return LA_FINISHED_PASS;
- }
- return LA_RUNNING_PASS;
- }
- void laui_InputMappingEntryKeySelector(laUiList *uil, laPropPack *Base, laPropPack *OperatorInst, laColumn *ExtraColumns, int context){
- laColumn* c=laFirstColumn(uil);
- laShowLabel(uil,c,"Press a Key:",0,0);
- laShowItem(uil,c,OperatorInst,"pressed_string")->Flags|=LA_UI_FLAGS_PLAIN;
- laUiItem* b=laBeginRow(uil,c,0,0);
- laShowSeparator(uil,c)->Expand=1;
- laShowItem(uil,c,0,"LA_confirm");
- laEndRow(uil,b);
- }
- void laget_KeyDetectorPressedString(laKeyDetectorData* kdd, char* out, char** pivot){
- if(kdd->IsController){
- if(kdd->Axis>=0){ sprintf(out, "Controller %d axis \"%s\" (0x%0x)", kdd->Device, SSTR(kdd->Str), kdd->Axis); }
- else{ sprintf(out, "Controller %d button \"%s\" (0x%0x)", kdd->Device, SSTR(kdd->Str), kdd->Button); }
- }else{
- sprintf(out, "Keyboard \"%s\" (0x%0x)", SSTR(kdd->Str), kdd->Key);
- }
- }
- int OPINV_SaveUserPreferences(laOperator *a, laEvent *e){
- laSaveUserPreferences(); return LA_FINISHED;
- }
- int OPMOD_RestoreFactorySettings(laOperator* a, laEvent* e){
- if (a->ConfirmData){
- if (a->ConfirmData->Mode == LA_CONFIRM_OK){
- if (laRestoreFactorySettings()){
- laEnableMessagePanel(0, 0, "Success", "Restart the program for changes to take effect.", e->x, e->y, 200, 0);
- MAIN.SavePreferenceOnExit = 0;
- }else{
- laEnableMessagePanel(0, 0, "Problem", "Unable to remove preference file.", e->x, e->y, 200, 0);
- }
- }
- return LA_FINISHED;
- }
- return LA_RUNNING;
- }
- int OPINV_RestoreFactorySettings(laOperator* a, laEvent* e){
- laEnableYesNoPanel(0, 0, "Confirm?", "This will remove the preference file.\nChanges take effect on restating the program.", e->x, e->y, 200, e);
- return LA_RUNNING;
- }
- int OPCHK_TerminateProgram(laPropPack *This, laStringSplitor *Instructions){
- return 1;
- }
- int OPINV_TerminateProgram(laOperator *a, laEvent *e){
- int empty=0; int mod=laRegisterModifications(1,1,&empty,0);
- if(mod || empty){ laInvoke(0, "LA_managed_save", 0,0,"on_exit=true;",0); return LA_FINISHED; }
- return LA_OPERATOR_CALLS_SHUTOFF;
- }
- int OPCHK_PropSetValue(laPropPack *This, laStringSplitor *Instructions){
- if (This && (!This->LastPs->p->ReadOnly)) return 1;
- else return 0;
- }
- int OPCHK_StringSetValue(laPropPack *This, laStringSplitor *Instructions){
- if (This && (This->LastPs->p->PropertyType == LA_PROP_STRING) && (!This->LastPs->p->ReadOnly)) return 1;
- else return 0;
- }
- int OPCHK_CollectionSetValue(laPropPack *This, laStringSplitor *Instructions){
- laSubProp*sp=This->LastPs->p;
- if (This && (This->LastPs->p->PropertyType == LA_PROP_SUB) && (!This->LastPs->p->ReadOnly) &&
- (sp->Base.UDFIsRefer && (!sp->Base.UDFIsSingle) && (sp->Base.Offset>=0||sp->Set||sp->SetState))) return 1;
- else return 0;
- }
- int OPINV_CollectionClearSelection(laOperator *a, laEvent *e){
- if(!a->This) return LA_CANCELED; laSubProp* sp=a->This->LastPs->p;
- laSetActiveInstance(sp, a->This->LastPs->UseInstance, 0);
- return LA_FINISHED;
- }
- int OPINV_PropSetDefault(laOperator *a, laEvent *e){
- if(!a->This) return LA_CANCELED; laProp* p=a->This->LastPs->p;
- if (p->PropertyType==LA_PROP_ENUM){
- laEnumProp *ep = a->This->LastPs->p; laSetEnum(a->This, ep->DefVal); }
- elif (p->PropertyType==(LA_PROP_ENUM|LA_PROP_ARRAY)){
- laEnumProp *ep = a->This->LastPs->p; laSetEnumArrayAll(a->This, ep->DefVal); }
- elif (p->PropertyType==LA_PROP_INT){
- laIntProp *ip = a->This->LastPs->p; laSetInt(a->This, ip->DefVal);}
- elif (p->PropertyType==(LA_PROP_INT|LA_PROP_ARRAY)){ laIntProp *ip = a->This->LastPs->p;
- if (ip->DefArr) laSetIntArrayAllArray(a->This, ip->DefArr); else laSetIntArrayAll(a->This, ip->DefVal); }
- elif (p->PropertyType==LA_PROP_FLOAT){
- laFloatProp *ip = a->This->LastPs->p; laSetFloat(a->This, ip->DefVal); }
- elif (p->PropertyType==(LA_PROP_FLOAT|LA_PROP_ARRAY)){ laFloatProp *ip = a->This->LastPs->p;
- if (ip->DefArr) laSetFloatArrayAllArray(a->This, ip->DefArr); else laSetFloatArrayAll(a->This, ip->DefVal); }
- elif (p->PropertyType==LA_PROP_STRING){laStringProp *sp = a->This->LastPs->p;
- if (sp->DefStr) laSetString(a->This, sp->DefStr); else laSetString(a->This, ""); }
- return LA_FINISHED;
- }
- int OPINV_PropSetMax(laOperator *a, laEvent *e){
- if(!a->This) return LA_CANCELED; laProp* p=a->This->LastPs->p;
- if (p->PropertyType==LA_PROP_INT){
- laIntProp *ip = a->This->LastPs->p; laSetInt(a->This, ip->Max); }
- elif (p->PropertyType==(LA_PROP_INT|LA_PROP_ARRAY)){
- laIntProp *ip = a->This->LastPs->p; laSetIntArrayAll(a->This, ip->Max); }
- elif (p->PropertyType==LA_PROP_FLOAT){
- laFloatProp *ip = a->This->LastPs->p; laSetFloat(a->This, ip->Max); }
- elif (p->PropertyType==(LA_PROP_FLOAT|LA_PROP_ARRAY)){
- laFloatProp *ip = a->This->LastPs->p; laSetFloatArrayAll(a->This, ip->Max); }
- return LA_FINISHED;
- }
- int OPINV_PropSetMin(laOperator *a, laEvent *e){
- if(!a->This) return LA_CANCELED; laProp* p=a->This->LastPs->p;
- if (p->PropertyType==LA_PROP_INT){
- laIntProp *ip = a->This->LastPs->p; laSetInt(a->This, ip->Min); }
- elif (p->PropertyType==(LA_PROP_INT|LA_PROP_ARRAY)){
- laIntProp *ip = a->This->LastPs->p; laSetIntArrayAll(a->This, ip->Min); }
- elif (p->PropertyType==LA_PROP_FLOAT){
- laFloatProp *ip = a->This->LastPs->p; laSetFloat(a->This, ip->Min); }
- elif (p->PropertyType==(LA_PROP_FLOAT|LA_PROP_ARRAY)){
- laFloatProp *ip = a->This->LastPs->p; laSetFloatArrayAll(a->This, ip->Min); }
- return LA_FINISHED;
- }
- int OPINV_StringGetFolderPath(laOperator *a, laEvent *e){
- if (a->This && (a->This->LastPs->p->PropertyType & LA_PROP_STRING)){
- laInvoke(a, "LA_file_dialog", e, 0, "select=folder;", 0);
- return LA_RUNNING;
- }
- return LA_FINISHED;
- }
- int OPINV_StringGetFilePath(laOperator *a, laEvent *e){
- if (a->This && (a->This->LastPs->p->PropertyType & LA_PROP_STRING)){
- laInvoke(a, "LA_file_dialog", e, 0, 0, 0);
- return LA_RUNNING;
- }
- return LA_FINISHED;
- }
- int OPMOD_StringGetFolderOrFilePath(laOperator *a, laEvent *e){
- if (a->ConfirmData){
- if (a->ConfirmData->StrData){
- laStringProp *sp = a->This->LastPs->p;
- laSetString(a->This, a->ConfirmData->StrData);
- return LA_FINISHED_PASS;
- }
- return LA_FINISHED_PASS;
- }
- return LA_RUNNING;
- }
- int OPINV_StringCopy(laOperator *a, laEvent *e){
- laPropPack* pp=a->This; if(!a->This) return LA_FINISHED;
- char _buf[256]={0}; char* buf=_buf;
- laGetString(pp,_buf,&buf);
- laCopyToClipboard(buf);
- return LA_FINISHED;
- }
- int OPINV_StringPaste(laOperator *a, laEvent *e){
- if (a->This && (a->This->LastPs->p->PropertyType & LA_PROP_STRING)){
- laStringProp *sp = a->This->LastPs->p;
- if (sp->DefStr) laSetString(a->This, sp->DefStr);
- else laSetString(a->This, "");
- }
- return LA_FINISHED;
- }
- int OPCHK_CombineChildBlocks(laPropPack *This, laStringSplitor *Instructions){
- laLayout *l = MAIN.CurrentWindow->CurrentLayout;
- laBlock *b = l->OnBlockSeperator;
- if (!(b)) return 0;
- }
- int OPINV_CombineChildBlocks(laOperator *a, laEvent *e){
- laLayout *l = MAIN.CurrentWindow->CurrentLayout;
- laBlock *b = l->OnBlockSeperator;
- if (!b) b = laDetectBlockRecursive(l->FirstBlock, e->x, e->y);
- if (b){
- laCombineChildBlocks(b);
- return LA_FINISHED;
- }
- return LA_CANCELED;
- }
- int OPCHK_PropInsertKey(laPropPack *This, laStringSplitor *Instructions){
- if (MAIN.Animation->CurrentAction && This && This->LastPs->p->Keyable) return 1;
- else return 0;
- }
- int OPINV_PropInsertKey(laOperator *a, laEvent *e){
- int err; laAction* aa=MAIN.Animation->CurrentAction;
- laAnimationInsertKeyFrame(aa,a->This->LastPs->UseInstance,a->This->LastPs->p,&err);
- if(err==1){
- laEnableMessagePanel(a,0,"Error","Action holder info missing.\nThis should not happen.",e->x,e->y,100,e);
- }elif(err==2){
- char msg[1024]; char _id[128]="unknown container",*id=_id,_idc[128]="unknown object",*idc=_idc;
- laTryGetInstanceIdentifier(aa->HolderInstance,aa->HolderContainer,_id,&id);
- laTryGetInstanceIdentifier(a->This->LastPs->UseInstance,a->This->LastPs->p->Container,_idc,&idc);
- sprintf(msg,"Can't insert key frame into current action.\n\"%s\" doesn't belong to \"%s\".",idc,id);
- laEnableMessagePanel(a,0,"Error",msg,e->x,e->y,100,e);
- }
- return LA_FINISHED;
- }
- STRUCTURE(laNewPanelData){
- laUiTemplate* SelectedTemplate;
- laBlock* b;
- };
- void laui_TitleOnly(laUiList *uil, laPropPack *This, laPropPack *OP_UNUSED, laColumn *Extra, int context){
- laColumn *col = Extra, *c, *cl, *cr, *crl, *crr, *cll, *clr, *clrl, *clrr, *clrrl, *clrrr;
- laUiItem *ui;
- c = laFirstColumn(uil);
- laShowItemFull(uil, c, This, "title", LA_WIDGET_STRING_PLAIN, 0, 0, 0);
- }
- laUiTemplate* laget_FirstPanelTemplate(void* unused1, void* unused2){
- return MAIN.PanelTemplates.pFirst;
- }
- void laset_NewPanelSetTemplate(laNewPanelData *np, laUiTemplate *uit, int State){
- np->SelectedTemplate = uit;
- }
- laUiTemplate* laget_NewPanelGetActiveTemplate(laNewPanelData* np, laUiTemplate* uit){
- return np->SelectedTemplate;
- }
- void laui_PanelTemplateSelect(laUiList *uil, laPropPack *This, laPropPack *OperatorProps, laColumn *UNUSED, int context){
- laColumn *c = laFirstColumn(uil);
- laUiItem* ui=laShowItem(uil, c, OperatorProps, "template");ui->SymbolID=2; ui->Flags|=LA_UI_FLAGS_NO_DECAL;
- }
- int OPINV_Fullscreen(laOperator *a, laEvent *e){
- laWindow* w=MAIN.CurrentWindow;
- int full=1;
- if(strArgumentMatch(a->ExtraInstructionsP,"restore","true")){ full=0; }
- if(strArgumentMatch(a->ExtraInstructionsP,"toggle","true")){ full=w->IsFullScreen?0:1; }
- #ifdef LA_LINUX
- XClientMessageEvent msg = {
- .type = ClientMessage, .display = MAIN.dpy, .window = w->win,
- .message_type = XInternAtom(MAIN.dpy, "_NET_WM_STATE", True), .format = 32,
- .data = {.l = {full, XInternAtom(MAIN.dpy, "_NET_WM_STATE_FULLSCREEN", True), None, 0, 1 }}
- };
- XSendEvent(MAIN.dpy, XRootWindow(MAIN.dpy, XDefaultScreen(MAIN.dpy)), False, SubstructureRedirectMask | SubstructureNotifyMask, (XEvent*) &msg);
- #endif
- #ifdef _WIN32
- DWORD dwStyle = GetWindowLong(w->win, GWL_STYLE);
- static WINDOWPLACEMENT g_wpPrev = { sizeof(g_wpPrev) };
- if (full){
- MONITORINFO mi = { sizeof(mi) };
- if (GetWindowPlacement(w->win, &g_wpPrev) &&
- GetMonitorInfo(MonitorFromWindow(w->win,
- MONITOR_DEFAULTTOPRIMARY), &mi)) {
- SetWindowLong(w->win, GWL_STYLE,
- dwStyle & ~WS_OVERLAPPEDWINDOW);
- SetWindowPos(w->win, HWND_TOP,
- mi.rcMonitor.left, mi.rcMonitor.top,
- mi.rcMonitor.right - mi.rcMonitor.left,
- mi.rcMonitor.bottom - mi.rcMonitor.top,
- SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
- }
- }else{
- SetWindowLong(w->win, GWL_STYLE,dwStyle|WS_OVERLAPPEDWINDOW);
- SetWindowPlacement(w->win, &g_wpPrev);
- SetWindowPos(w->win,NULL,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_NOOWNERZORDER|SWP_FRAMECHANGED);
- }
- #endif
- w->IsFullScreen=full;
- laRedrawCurrentWindow();
- return LA_FINISHED;
- }
- int OPINV_NewLayout(laOperator *a, laEvent *e){
- laWindow* w=MAIN.CurrentWindow;
- laDesignLayout(w, "New Layout");
- laRedrawCurrentWindow();
- return LA_FINISHED;
- }
- int OPCHK_RemoveLayout(laPropPack *This, laStringSplitor *Instructions){
- laWindow* w=MAIN.CurrentWindow; if(w->Layouts.pFirst==w->Layouts.pLast) return 0;
- return 1;
- }
- int OPINV_RemoveLayout(laOperator *a, laEvent *e){
- laWindow* w=MAIN.CurrentWindow; if(w->Layouts.pFirst==w->Layouts.pLast) return LA_FINISHED;
- laDestroyLayout(w,w->CurrentLayout); laRedrawCurrentWindow();
- return LA_FINISHED;
- }
- int OPINV_NewPanel(laOperator *a, laEvent *e){
- laNewPanelData* np= memAcquire(sizeof(laNewPanelData));
- a->CustomData = np;
- laEnableOperatorPanel(a, 0, e->x-50,e->y-50,500,500,10000,0,0,0,0,0,0,0,e);
- return LA_RUNNING;
- }
- int OPMOD_NewPanel(laOperator *a, laEvent *e){
- laLayout *l = MAIN.CurrentWindow->CurrentLayout;
- laNewPanelData* np=a->CustomData;
- if(!a->ConfirmData) return LA_RUNNING;
- if(a->ConfirmData->Mode == LA_CONFIRM_CANCEL||a->ConfirmData->Mode == LA_CONFIRM_OK){ if(np) memFree(np); return LA_CANCELED; }
- if(a->ConfirmData->Mode == LA_CONFIRM_DATA){
- if (!np || !np->SelectedTemplate){ if(np) memFree(np); return LA_CANCELED; }
- laPanel *p = la_FindFreePanelByTemplate(MAIN.CurrentWindow, np->SelectedTemplate);
- if (!p){
- p = laCreateTopPanel(MAIN.CurrentWindow, np->SelectedTemplate->Identifier->Ptr, e->x, e->y,0,0,0,0,0,0,0,0,0,0);
- }
- laShowPanelWithExpandEffect(p); laPopPanel(p); memFree(np);
- return LA_FINISHED;
- }
- return LA_RUNNING;
- }
- int OPINV_BlockFoldTitle(laOperator *a, laEvent *e){
- laBlock* b=a->This?a->This->EndInstance:0;
- if(!b) return LA_CANCELED;
- if(strSame(strGetArgumentString(a->ExtraInstructionsP, "show"), "true")) laUnfoldBlockTitle(b);
- else laFoldBlockTitle(b);
-
- return LA_FINISHED;
- }
- int OPINV_BlockMaximize(laOperator *a, laEvent *e){
- laBlock* b=a->This?a->This->EndInstance:0;
- if(!b || strSame(strGetArgumentString(a->ExtraInstructionsP, "restore"), "true")) laRestoreToLayout();
- else laMaximizeBlock(b);
-
- return LA_FINISHED;
- }
- int OPINV_CanvasUiMaximize(laOperator *a, laEvent *e){
- laUiItem* ui=a->This?a->This->EndInstance:0;
- laPanel* p=MAIN.CurrentPanel;
- if(!ui || !p || (!ui->Type->Tag&LA_UI_TAG_IS_OFFSCREEN) || MAIN.CurrentWindow->MaximizedUi ||
- strSame(strGetArgumentString(a->ExtraInstructionsP, "restore"), "true")) laRestoreCanvasUI();
- else laMaximizeCanvasUI(ui,p);
-
- return LA_FINISHED;
- }
- int OPINV_HideMenuBar(laOperator *a, laEvent *e){
- if(!MAIN.CurrentWindow->MaximizedUi || strSame(strGetArgumentString(a->ExtraInstructionsP, "restore"), "true")) laShowMenuBar();
- else laHideMenuBar();
-
- return LA_FINISHED;
- }
- int OPINV_BlockTearOffPanel(laOperator *a, laEvent *e){
- laLayout *l = MAIN.CurrentWindow->CurrentLayout;
- laBlock* b = l->OperatingBlock;
- if (!b) b = laDetectBlockRecursive(l->FirstBlock, e->x, e->y);
- if(!b) return LA_CANCELED;
-
- laTearOffPanel(b,0);
-
- return LA_FINISHED;
- }
- int OPCHK_BlockHasMorePanels(laPropPack *This, laStringSplitor *Instructions){
- laPanel*p = This?This->LastPs->UseInstance:0;
- if(p && p->Mode == LA_PANEL_FLOATING_TOP) return 1;
- laLayout *l = MAIN.CurrentWindow->CurrentLayout;
- laBlock *b = l->OperatingBlock;
- if (b && b->Panels.pFirst == b->Panels.pLast) return 0;
- return 1;
- }
- int OPINV_BlockClosePanel(laOperator *a, laEvent *e){
- laPanel*p = a->This?a->This->EndInstance:0;
- if(p && p->Mode == LA_PANEL_FLOATING_TOP){
- laDestroySinglePanel(p,0);
- return LA_FINISHED;
- }
- laLayout *l = MAIN.CurrentWindow->CurrentLayout;
- laBlock *b = l->OperatingBlock;
- int x = e->x, y = e->y;
- if (!b) b = laDetectBlockRecursive(l->FirstBlock, e->x, e->y);
- if (b){
- if (b->CurrentPanel){
- //laLocalToWindow(a, MAIN.CurrentPanel, &x, &y);
- laEnableYesNoPanel(a, 0, "Caution!", "Are you sure to destroy this panel?", e->x - 250, e->y, 250, e);
- return LA_RUNNING;
- }
- }
- return LA_CANCELED;
- }
- int OPMOD_BlockClosePanel(laOperator *a, laEvent *e){
- laLayout *l = MAIN.CurrentWindow->CurrentLayout;
- laBlock *b = l->OperatingBlock;
- if (e->type == LA_ESCAPE_DOWN) return LA_FINISHED;
- if (a->ConfirmData){
- if (!b) b = laDetectBlockRecursive(l->FirstBlock, e->x, e->y);
- if (!b) return LA_CANCELED;
- if (a->ConfirmData->Mode == LA_CONFIRM_OK){
- laDestroySinglePanel(b->CurrentPanel,1);
- la_RecalcBlockRecursive(b, b->X, b->Y, b->W, b->H);
- }
- return LA_FINISHED;
- }else
- return LA_RUNNING;
- }
- int laui_BlockEdgeMenu(laOperator *WindowAct, laLayout *l, laBlock *b, laEvent *e){
- laPanel *p;
- laColumn *c, *cl, *cr;
- laUiList *uil;
- p = laDefineAndEnableMenuPanel(0, WindowAct, 0, e->x, e->y, 500, 200, e);
- uil = laPrepareUi(p);
- c = laFirstColumn(uil);
- laSplitColumn(uil, c, 0.5);
- cl = laLeftColumn(c, 0);
- cr = laRightColumn(c, 0);
- laShowItem(uil, c, 0, "LA_combine_child_blocks");
- laEnclosePanelContent(p,uil);
- }
- laBlock* la_MakeDropBlock(laBlock* DropToBlock, int DropLocation){
- switch (DropLocation){
- case 0: return DropToBlock;
- case LA_BLOCK_DROP_LOCATION_U:
- laSplitBlockVertical(DropToBlock, 0.5); laSwapSubBlocks(DropToBlock);
- return DropToBlock->B1;
- case LA_BLOCK_DROP_LOCATION_B:
- laSplitBlockVertical(DropToBlock, 0.5);
- return DropToBlock->B2;
- case LA_BLOCK_DROP_LOCATION_L:
- laSplitBlockHorizon(DropToBlock, 0.5); laSwapSubBlocks(DropToBlock);
- return DropToBlock->B1;
- case LA_BLOCK_DROP_LOCATION_R:
- laSplitBlockHorizon(DropToBlock, 0.5);
- return DropToBlock->B2;
- }
- }
- void la_StartDocking(laWindow* from, laPanel* p){
- for(laWindow* w=MAIN.Windows.pFirst;w;w=w->Item.pNext){ w->DockingFrom = from; w->IsDocking=1; } MAIN.DockingPanel=p;
- }
- void la_StopDocking(){
- for(laWindow* w=MAIN.Windows.pFirst;w;w=w->Item.pNext){ w->DockingFrom = 0; w->IsDocking=0; } MAIN.DockingPanel=0;
- }
- void la_ClearDockingTarget(){
- for(laWindow* w=MAIN.Windows.pFirst;w;w=w->Item.pNext){ w->CurrentLayout->DropToBlock=0; }
- }
- int OPINV_DockPanel(laOperator* a, laEvent* e){
- laPanel*p = a->This?a->This->EndInstance:0;
- if(!p) return LA_CANCELED;
- la_StartDocking(MAIN.CurrentWindow, p);
- laRestoreToLayout();
- laRestoreCanvasUI();
- return LA_FINISHED;
- }
- int OPINV_NewWindow(laOperator* a, laEvent* e){
- laWindow* w = a->This?a->This->EndInstance:MAIN.CurrentWindow;
-
- laWindow* nw =laDesignWindow(w->X,w->Y,w->W,w->H);
- laLayout* l=(w->Layouts.pFirst!=w->Layouts.pLast)?w->CurrentLayout:0;
- if (l && !strSame(strGetArgumentString(a->ExtraInstructionsP, "clean"), "true")){
- laLayout* nextl=l->Item.pPrev?l->Item.pPrev:l->Item.pNext;
- memAssignRef(w, &w->CurrentLayout, nextl);
- lstRemoveItem(&w->Layouts, l); lstAppendItem(&nw->Layouts, l);
- memAssignRef(nw, &nw->CurrentLayout, l);
- laRenameWindow(nw, l->ID->Ptr);
- laRenameWindow(w, w->CurrentLayout->ID->Ptr);
- }else{
- laDesignLayout(nw, "Empty Layout");
- }
- laStartWindow(nw);
- laRedrawAllWindows();
- return LA_FINISHED;
- }
- void *la_OnBlockSeperator(laBlock *b, laEvent *e){
- int at;
- laBlock *bb;
- if (!b->B1) return 0;
- if (b->Vertical){
- at = b->H * b->SplitRatio + b->Y;
- if (e->x>=b->X && e->x<=b->X+b->W && e->y >= at - LA_SEAM_W && e->y <= at + LA_SEAM_W){
- return b;
- }
- }else{
- at = b->X + b->W * b->SplitRatio;
- if (e->y>=b->Y && e->y<=b->Y+b->H && e->x >= at - LA_SEAM_W && e->x <= at + LA_SEAM_W){
- return b;
- }
- }
- if (bb = la_OnBlockSeperator(b->B1, e)) return bb;
- else
- return la_OnBlockSeperator(b->B2, e);
- }
- int la_DetectBlockDropLocation(laBlock *b, int X, int Y){
- laPanel *p = b->Panels.pFirst;
- if (!p) return 0;
- real L = tnsGetRatiod(p->X, p->X + p->W, X);
- real U = tnsGetRatiod(p->Y, p->Y + p->H, Y);
- if (L > U){
- if (U < 0.25){
- if (L < 0.75) return LA_BLOCK_DROP_LOCATION_U;
- else
- return LA_BLOCK_DROP_LOCATION_R;
- }else{
- if (L < 0.75) return 0;
- else
- return LA_BLOCK_DROP_LOCATION_R;
- }
- }else{
- if (U > 0.75){
- if (L < 0.25) return LA_BLOCK_DROP_LOCATION_L;
- else
- return LA_BLOCK_DROP_LOCATION_B;
- }else{
- if (L < 0.25) return LA_BLOCK_DROP_LOCATION_L;
- else
- return 0;
- }
- }
- }
- int laui_BlockMenu(laOperator *WindowAct, laWindow* w, laLayout *l, laBlock *b, laEvent *e){
- laPanel *p;
- laColumn *c;
- laUiList *uil;
- p = laDefineAndEnableMenuPanel(0, WindowAct, 0, b->X, b->Y + LA_RH + 1, 500, 500, e);
- uil = laPrepareUi(p);
- c = laFirstColumn(uil);
- laPanel* forp=b->CurrentPanel;
- laUiItem* b1=laBeginRow(uil,c,0,0);
- laShowItem(uil,c,&b->PP,"fold");
- laUiItem* b2=laOnConditionThat(uil,c,laPropExpression(&w->PP, "maximized_block"));{
- laShowItemFull(uil,c,&b->PP,"maximize",0,"restore=true;text=Restore;",0,0);
- }laElse(uil,b2);{
- laShowItem(uil,c,&b->PP,"maximize");
- }laEndCondition(uil,b2);
- laEndRow(uil,b1);
- laShowSeparator(uil,c);
- if(forp->PanelTemplate && forp->PanelTemplate->Header){
- laShowLabel(uil, c, "Panel properties:", 0, 0);
- forp->PanelTemplate->Header(uil, &forp->PP, &forp->PropLinkPP, c, 0);
- }else{
- if(forp->PropLinkPP.LastPs->p->SubProp->Props.pFirst){
- for(laProp* p = forp->PropLinkPP.LastPs->p->SubProp->Props.pFirst;p;p=p->Item.pNext){
- if(p->PropertyType&LA_PROP_SUB){
- laShowItemFull(uil, c, &forp->PropLinkPP, p->Identifier, LA_WIDGET_COLLECTION_SELECTOR,0,laui_IdentifierOnly,0);
- }else{ laShowItem(uil, c, &forp->PropLinkPP, p->Identifier); }
- }
- }else{
- laShowLabel(uil, c, "Panel doesn't have configurable property.", 0, 0);
- }
- }
- //laShowItem(uil, c, 0, "LA_new_panel");
- //laShowItem(uil, c, 0, "LA_block_close_panel");
- //laShowItem(uil, c, 0, "LA_block_tear_off_panel");
- laEnclosePanelContent(p,uil);
- }
- int la_ProcessBlockEvent(laOperator *a, laBlock *b, laEvent *e){
- int Executed = 0, Ret=1;
- int L = LA_RH+LA_SEAM_W, R, tw = 0;
- real ratio = 1.0f;
- laPanel *p = b->Panels.pFirst;
- laGeneralUiExtraData *uid = a->CustomData;
- laLayout *l;
- if(!b->Panels.pFirst){return 0;}
- if (laIsInBlockHeader(b, e->x, e->y) || MAIN.CurrentWindow->CurrentLayout->ClickedPanel){
- MAIN.CurrentWindow->CurrentLayout->OperatingBlock = b;
- if (b->CurrentPanel){
- if (e->type == LA_MOUSE_WHEEL_DOWN && b->CurrentPanel->Item.pNext){
- b->CurrentPanel = b->CurrentPanel->Item.pNext; Executed = 1;
- }elif (e->type == LA_MOUSE_WHEEL_UP && b->CurrentPanel->Item.pPrev){
- b->CurrentPanel = b->CurrentPanel->Item.pPrev; Executed = 1;
- }
- }
- if(!b->Folded){
- for (p = b->Panels.pFirst; p; p = p->Item.pNext){ tw += (p->TitleWidth + LA_SEAM_W*2); }
- if (tw > b->W - LA_SEAM_W*2 - LA_RH) ratio = (real)(b->W - LA_SEAM_W*2 - LA_RH) / tw;
- if ((e->type == LA_L_MOUSE_DOWN)){
- uid->LastX = e->x;
- uid->LastY = e->y;
- int LT=0,RT=0;
- for (p = b->Panels.pFirst; p; p = p->Item.pNext){
- RT = LT + p->TitleWidth+LA_SEAM_W*2;
- if (e->x >= b->X + L+LT * ratio && e->x < b->X + L+RT * ratio){
- MAIN.CurrentWindow->CurrentLayout->ClickedPanel = p; b->CurrentPanel = p; Executed = 1;
- }
- LT = RT;
- }
- }elif (e->type == LA_MOUSEMOVE){
- if (abs(e->x - uid->LastX) > LA_RH*3 || abs(e->y - uid->LastY) > LA_RH*3){
- if (MAIN.CurrentWindow->CurrentLayout->ClickedPanel){
- l = MAIN.CurrentWindow->CurrentLayout;
- l->DropToBlock = b;
- l->DropLocation = la_DetectBlockDropLocation(b, e->x, e->y);
- laRefreshWindow();
- }
- }
- }elif (e->type == LA_L_MOUSE_UP){
- l = MAIN.CurrentWindow->CurrentLayout;
- if (l->DropToBlock){
- l->DropToBlock = la_MakeDropBlock(l->DropToBlock,l->DropLocation);
- p = l->ClickedPanel;
- if(p->Block == l->DropToBlock){
- if(laTearOffPanel(p->Block, p)) Executed=1;
- }else{
- p->Block->CurrentPanel = p->Item.pPrev ? p->Item.pPrev : (p->Item.pNext ? p->Item.pNext : 0);
- lstRemoveItem(&p->Block->Panels, p); laBlock* orig_block=p->Block->parent;
- int clear=0; if(!lstHaveItemInList(&p->Block->Panels)){clear=1;}
- lstPushItem(&l->DropToBlock->Panels, p);
- p->Block = l->DropToBlock;
- if(clear){
- laCombineChildBlocks(orig_block);
- if(!lstFindItem(orig_block->CurrentPanel,nutSameAddress,&orig_block->Panels)){
- orig_block->CurrentPanel = orig_block->Panels.pFirst;
- }
- }
- p->Block->CurrentPanel = p;
- Executed = 1;
- la_RecalcBlockRecursive(p->Block, p->Block->X, p->Block->Y, p->Block->W, p->Block->H);
- if(orig_block!=p->Block){
- la_RecalcBlockRecursive(orig_block, orig_block->X, orig_block->Y, orig_block->W, orig_block->H);
- }
- }
- }
- MAIN.CurrentWindow->CurrentLayout->DropToBlock = 0;
- MAIN.CurrentWindow->CurrentLayout->ClickedPanel = 0;
- return 0;
- }
- }else{
- if(!b->OnButton){ b->OnButton=1; laRefreshWindow(); } Ret=0;
- if(laIsInBlockBotton1(b, e->x, e->y)){ if(b->OnButton!=2){b->OnButton=2;laRefreshWindow();} if(e->type==LA_L_MOUSE_DOWN){laUnfoldBlockTitle(b);Executed=1;Ret=1;} }
- elif(laIsInBlockBotton2(b, e->x, e->y)){ if(b->OnButton!=2){b->OnButton=2;laRefreshWindow();} if(e->type==LA_L_MOUSE_DOWN){laMaximizeBlock(b);Executed=1;Ret=1;} }
- }
- if (Executed){
- laRecalcPanel(b->CurrentPanel);
- la_RecalcBlockRecursive(b, b->X, b->Y, b->W, b->H);
- }
- if (!Executed && e->type == LA_L_MOUSE_DOWN && laIsInBlockBotton1(b, e->x, e->y)){
- laui_BlockMenu(a, MAIN.CurrentWindow, MAIN.CurrentWindow->CurrentLayout, b, e);
- }
- return Ret;
- }else{
- if(b->OnButton){b->OnButton=0;laRefreshWindow();}
- }
- return 0;
- }
- int la_ProcessBlockEdgeEvent(laOperator *WindowAct, laLayout *l, laBlock *b, laEvent *e){
- laBlock *ob = l->MovingBlock;
- laWindow *w = WindowAct->Instance;
- if (e->type == LA_MOUSEMOVE && ob && l->MovingBlock && l->IsMoving){
- if (ob->Vertical) ob->SplitRatio = (real)(e->y - ob->Y) / (real)(ob->H);
- else ob->SplitRatio = (real)(e->x - ob->X) / (real)(ob->W);
- la_RecalcBlockRecursive(ob, ob->X, ob->Y, ob->W, ob->H);
- if (ob->B1->CurrentPanel) laRecalcPanel(ob->B1->CurrentPanel);
- if (ob->B2->CurrentPanel) laRecalcPanel(ob->B2->CurrentPanel);
- return 1;
- }
- if (ob = la_OnBlockSeperator(b, e)){
- ob->B1->OnButton=ob->B2->OnButton=0;
- if(l->MovingBlock!=ob){ laRefreshWindow(); }
- l->MovingBlock = ob; laSetWindowCursor(ob->Vertical?LA_UP_AND_DOWN:LA_LEFT_AND_RIGHT);
- if (e->type == LA_L_MOUSE_DOWN){
- l->IsMoving = 1;
- }elif (e->type == LA_L_MOUSE_UP){
- l->IsMoving = 0;
- }elif (e->type == LA_R_MOUSE_DOWN){
- l->OnBlockSeperator = ob;
- laui_BlockEdgeMenu(WindowAct, l, ob, e);
- }
- return 1;
- }
- if(l->MovingBlock){ l->MovingBlock = 0; laRefreshWindow(); laSetWindowCursor(LA_ARROW); }
- return 0;
- }
- real la_ScrollerVerticalPan(int MousePanY, laPanel *p, laUiList *suil, laUiItem *pui){
- int DisplayH, TotalH;
- if (!pui){ DisplayH = p->H-suil->U; }
- else{ DisplayH = pui->Page?(pui->B-pui->Page->U):(pui->B - pui->U); }
- TotalH = suil->B - suil->U;
- return ((real)TotalH * (real)MousePanY / (real)DisplayH);
- }
- real la_ScrollerHorizontalPan(int MousePanX, laPanel *p, laUiList *suil, laUiItem *pui){
- int DisplayW, TotalW;
- DisplayW = pui->Page?(pui->R-pui->Page->L):(pui->R - pui->L);
- TotalW = suil->R - suil->L;
- return ((real)TotalW * (real)MousePanX / (real)DisplayW);
- }
- void laui_LayoutCycle(laUiList *uil, laPropPack *This, laPropPack *OperatorProps, laColumn *UNUSED, int context){
- laColumn *c;
- c = laFirstColumn(uil);
-
- laShowItemFull(uil, c, 0, "la.windows.layouts", 0, 0, laui_IdentifierOnly, 0);
- laUiItem* b=laBeginRow(uil,c,0,0);
- laShowItem(uil, c, 0, "LA_new_layout")->Expand=1;
- laShowItem(uil, c, 0, "LA_remove_layout")->Flags|=LA_UI_FLAGS_ICON|LA_UI_FLAGS_NO_CONFIRM;
- laEndRow(uil,b);
- }
- int OPINV_SwitchLayout(laOperator *a, laEvent *e){
- laWindow *w = MAIN.CurrentWindow; if (!w) return LA_FINISHED;
- if (strSame(strGetArgumentString(a->ExtraInstructionsP, "show_list"), "true")){
- laPanel* p =laEnableOperatorPanel(a, 0, e->x-LA_RH, e->y-LA_RH, 500, 500, 0,0,0,0,0,0,0,0,e);
- return LA_RUNNING;
- }
- laLayout* newlayout;
- if (strSame(strGetArgumentString(a->ExtraInstructionsP, "reverse"), "true")) newlayout = w->CurrentLayout->Item.pPrev ? w->CurrentLayout->Item.pPrev : w->Layouts.pLast;
- else newlayout = w->CurrentLayout->Item.pNext ? w->CurrentLayout->Item.pNext : w->Layouts.pFirst;
- memAssignRef(w, &w->CurrentLayout, newlayout);
- laRenameWindow(w, w->CurrentLayout->ID->Ptr);
- la_StopAllOperators();
- laRetriggerOperators();
- laRedrawCurrentWindow();
- laNotifyUsers("la.windows.layouts");
- return LA_FINISHED;
- }
- int OPINV_DeleteTheme(laOperator *a, laEvent *e){
- laTheme* t = a->This?a->This->EndInstance:MAIN.CurrentTheme;
- if(!t || MAIN.Themes.pFirst == MAIN.Themes.pLast) return LA_CANCELED;
- laBoxedTheme* NextBt;
- for(laBoxedTheme* bt=t->BoxedThemes.pFirst; bt; bt=NextBt){
- NextBt = bt->Item.pNext; lstRemoveItem(&t->BoxedThemes, bt); memFree(bt);
- }
- lstRemoveItem(&MAIN.Themes, t); memFree(t);
- if(t==MAIN.CurrentTheme){MAIN.CurrentTheme = MAIN.Themes.pFirst;la_RefreshThemeColor(MAIN.CurrentTheme);}
- laNotifyUsers("themes"); laRedrawCurrentWindow();
- return LA_FINISHED;
- }
- int la_GenericTopPanelProcessing(laOperator* a, laEvent* e){
- laPanel* p;
- if (p = laDetectPanel(e->x, e->y)){
- int x = e->x;
- int y = e->y;
- laWindowToLocal(0, p, &x, &y);
- if (laIsInPanel(p, x, y) /*&& p->Show*/){
- laSetOperatorLocalizer(p);
- laInvokeUi(a, "LA_panel_operator", e, p, 0, 1);
- return LA_RUNNING;
- }
- }
- return 0;
- }
- int la_GeneratePasteEvent(laWindow* w){
- #ifdef LA_LINUX
- XConvertSelection(MAIN.dpy, MAIN.bufid, MAIN.fmtid, MAIN.propid, w->win, CurrentTime);
- #endif
- }
- int OPINV_SystemPaste(laOperator *a, laEvent *e){ la_GeneratePasteEvent(MAIN.CurrentWindow); return LA_FINISHED; }
- int OPINV_Window(laOperator *a, laEvent *e){
- laRetriggerOperators();
- return LA_RUNNING;
- }
- int OPMOD_Window(laOperator *a, laEvent *e){
- laPanel *p;
- laBlock *b = 0;
- laWindow *w = a->Instance;
- laGeneralUiExtraData *uid = a->CustomData;
- if (!uid) uid = memAcquireSimple(sizeof(laGeneralUiExtraData));
- a->CustomData = uid;
- if(laKeyMapExecuteEvent(a, &MAIN.KeyMap, e)) return LA_RUNNING_PASS;
- if(w->IsDocking && MAIN.DockingPanel){
- laRestoreToLayout();
- laRestoreCanvasUI();
- laLayout* l=MAIN.CurrentWindow->CurrentLayout;
- laBlock *Recieve = laDetectBlockRecursive(l->FirstBlock, e->x, e->y);
- if (Recieve){
- la_ClearDockingTarget(); l->DropToBlock = Recieve;
- l->DropLocation = la_DetectBlockDropLocation(Recieve, e->x, e->y);
- laRefreshWindow();
- }else{
- MAIN.CurrentWindow->CurrentLayout->DropToBlock = 0;
- }
- if(e->type==LA_L_MOUSE_UP && l->DropToBlock){
- l->DropToBlock = la_MakeDropBlock(l->DropToBlock, l->DropLocation);
- laDockPanel(w->DockingFrom, l->DropToBlock, MAIN.DockingPanel);
- la_StopDocking();la_ClearDockingTarget(); return LA_RUNNING;
- }
- if(e->type==LA_R_MOUSE_DOWN || (e->type==LA_KEY_DOWN&&e->key==LA_KEY_ESCAPE)){
- la_StopDocking();la_ClearDockingTarget(); return LA_RUNNING;
- }
- return LA_RUNNING;
- }
- if(w->MaximizedUi && w->MaximizedUiPanel){
- if(((e->y<LA_RH && e->x<LA_RH)||e->y<LA_SEAM_W) && uid->Dragging){ laShowMenuBar(); uid->Dragging=0; }
- if(!la_UiOperatorExists(w->MaximizedUi)){
- laSetOperatorLocalizer(w->MaximizedUiPanel);
- laInvokeUi(a, w->MaximizedUi->Type->OperatorID, e, w->MaximizedUi, 0, 1);
- return LA_RUNNING;
- }
- if(e->y>LA_2RH && e->x>LA_2RH){ if(!uid->Dragging)laRequestDelayEvent(0.5); uid->Dragging=1; }
- if(e->type==LA_TIME_DELAY){ laHideMenuBar(); }
- }else{
- if(MAIN.PendingSplash){
- laSetOperatorLocalizer(MAIN.PendingSplash);
- laInvokeUi(a, "LA_panel_operator", e, MAIN.PendingSplash, 0, 1);
- laRetriggerOperators();
- MAIN.PendingSplash=0; return LA_RUNNING;
- }
- laBlock* RootBlock=w->MaximizedBlock?w->MaximizedBlock:w->CurrentLayout->FirstBlock;
- if (la_ProcessBlockEdgeEvent(a, w->CurrentLayout, RootBlock, e)) return LA_RUNNING;
- b = w->MaximizedBlock?w->MaximizedBlock:laDetectBlockRecursive(w->CurrentLayout->FirstBlock, e->x, e->y);
- laClearBlockButtonRecursive(RootBlock,b);
- if (b && la_ProcessBlockEvent(a, b, e)) return LA_RUNNING;
-
- for (p = w->Panels.pFirst; p; p = p->Item.pNext){
- int x = e->x; int y = e->y;
- laWindowToLocal(0, p, &x, &y);
- if (laIsInPanel(p, x, y) && p->Show){
- laSetOperatorLocalizer(p);
- if (!p->LaterDestroy) laInvokeUi(a, "LA_panel_operator", e, p, 0, 1);
- return LA_RUNNING;
- }
- }
- }
-
- if(la_GenericTopPanelProcessing(a,e)) return LA_RUNNING;
- return LA_RUNNING;
- }
- int OPINV_Panel(laOperator *a, laEvent *e){
- if (!((laPanel *)a->Instance)->Show) return LA_FINISHED;
- a->CustomData = memAcquireSimple(sizeof(laGeneralUiExtraData));
- laRetriggerOperators();
- return LA_RUNNING;
- }
- void OPEXT_Panel(laOperator *a, int ExitCode){
- memFree(a->CustomData);
- }
- int la_ScrollPanel(laGeneralUiExtraData*ex, laPanel*p, laEvent* e){
- int ret=0;
- if(ex->TargetIndexVali==4 && e->type==LA_MOUSEMOVE){
- laUiList* uuil=ex->Ptr1; laUiItem* upui=ex->Ptr2;
- if(upui){ laPanUiListFree(uuil, ex->LastX-e->x, ex->LastY-e->y);
- //if(uuil->HeightCoeff){
- if(uuil->B-upui->Page->PanY<upui->TB-(*p->BT)->BM-LA_SCROLL_W){
- upui->Page->PanY = (uuil->B-upui->TB+(*p->BT)->BM+LA_SCROLL_W);
- if(upui->Page->PanY<0){upui->Page->PanY=0;}
- }
- //}
- }
- ex->LastX=e->x; ex->LastY=e->y;
- laRedrawCurrentPanel();
- ret= 1;
- }
- if(ex->TargetIndexVali==5 && e->type==LA_MOUSEMOVE){
- laUiList* uuil=ex->Ptr1; laUiItem* upui=ex->Ptr2;
- if(upui)laScaleUiList(uuil, -(ex->LastY-e->y)*0.005+1, upui->L, upui->R, upui->U, upui->B);
- ex->LastX=e->x; ex->LastY=e->y;
- laRecalcCurrentPanel();
- ret= 1;
- }
- if(e->type==LA_M_MOUSE_UP){ ex->TargetIndexVali=0; }
- if (e->type & LA_KEY_MOUSE_SCROLL || e->type==LA_M_MOUSE_DOWN){
- laUiItem *pui = 0; laListHandle levels={0}; int dir;
- if (e->type & LA_STATE_DOWN) dir=1;
- elif (e->type & LA_STATE_UP) dir=-1;
- laUiList *duil = la_DetectUiListRecursiveDeep(p->MenuRefer?p->MenuRefer:&p->UI, e->x, e->y, 10000, &pui, 0, 0, 0, 0, &levels);
- laUiListRecord* lip=levels.pLast; laUiList* uuil=lip->uil; laUiItem* upui=lip->Item.pPrev?((laUiListRecord*)lip->Item.pPrev)->pui:0; int ran=0;
- if(e->SpecialKeyBit == LA_KEY_CTRL){
- if(e->type==LA_M_MOUSE_DOWN){
- while (lip && upui && (!uuil->AllowScale)) { lip=lip->Item.pPrev; uuil=lip->uil; upui=lip->Item.pPrev?((laUiListRecord*)lip->Item.pPrev)->pui:0; }
- if(uuil) { ex->TargetIndexVali=5; ex->Ptr1=uuil; ex->Ptr2=upui; ex->LastX=e->x; ex->LastY=e->y; ret= 1;}
- }else{
- }
- }else{
- if(e->type==LA_M_MOUSE_DOWN){
- while (lip && upui && (!uuil->AllowScale)) { lip=lip->Item.pPrev; uuil=lip->uil; upui=lip->Item.pPrev?((laUiListRecord*)lip->Item.pPrev)->pui:0; }
- if(uuil) { ex->TargetIndexVali=4; ex->Ptr1=uuil; ex->Ptr2=upui; ex->LastX=e->x; ex->LastY=e->y; ret= 1;}
- }else{
- while (lip && upui){
- if(uuil->AllowScale){ if((ran=laScaleUiList(uuil, 1.0f-dir*0.1, upui->L, upui->R, upui->U, upui->B))){ laRecalcCurrentPanel(); break;} }
- else{ if((ran=laPanUiListAuto(uuil, 0, dir*MAIN.ScrollingSpeed*LA_RH,
- uuil->L, upui->R-(uuil->ScrollerShownV?(LA_SCROLL_W+(*p->BT)->RM):0),
- uuil->U, upui->B-(*upui->Type->Theme)->BM-(uuil->ScrollerShownH?(LA_SCROLL_W+(*p->BT)->BM):0)))) break; }
- lip=lip->Item.pPrev; uuil=lip->uil; upui=lip->Item.pPrev?((laUiListRecord*)lip->Item.pPrev)->pui:0;
- }
- if(!ran) laPanUiListAuto(p->MenuRefer?p->MenuRefer:&p->UI, 0, dir*MAIN.ScrollingSpeed*LA_RH, 0, p->W, p->TitleBar.B+(*p->BT)->TM, p->H-(*p->BT)->BM);
- laRedrawCurrentPanel();
- ret= 1;
- }
- }
- while(duil=lstPopPointer(&levels));
- }
- return ret;
- }
- int OPMOD_Panel(laOperator *a, laEvent *e){
- int x = e->x;
- int y = e->y;
- laPanel *p = a->Instance, *dp;
- laUiItem *ui = 0;
- laGeneralUiExtraData *uid = a->CustomData;
- laListHandle Locals = {0};
- int RET=LA_RUNNING|(p->IsMenuPanel?0:LA_PASS_ON);
- if(MAIN.DockingPanel){ return LA_FINISHED; }
- if (!p->Show || (!laIsInPanel(p, x, y) && !uid->TargetIndexVali)){
- if(p->CloseWhenMovedOut==2){
- if(e->type&LA_STATE_DOWN){
- la_StopUiOperatorService(p); laDestroySinglePanel(p,0); return LA_FINISHED;
- }
- return LA_RUNNING;
- }
- if(p->ShowCorner){ p->ShowCorner=0; laSetWindowCursor(LA_ARROW); laRefreshWindow(); }
- return LA_FINISHED_PASS;
- }
- if(((e->type==LA_KEY_DOWN && e->key==LA_KEY_ESCAPE)||(e->type==LA_R_MOUSE_DOWN)) && p->CloseWhenMovedOut==2){
- la_StopUiOperatorService(p); laDestroySinglePanel(p,0); return LA_FINISHED;
- }
- int NoPrimaryUI=(p==MAIN.CurrentWindow->MaximizedUiPanel);
- if(p->PanelTemplate && laKeyMapExecuteEvent(a, &p->PanelTemplate->KeyMap, e)) return RET;
- int IsTop=laIsTopPanel(p);
- if (!IsTop && !uid->TargetIndexVali){
- laLocalToWindow(0, p, &x, &y);
- dp = laDetectPanel(x, y);
- if (dp && dp->Mode && dp != p){
- return LA_FINISHED;
- }else if ((e->type & LA_MOUSEDOWN) == LA_MOUSEDOWN){
- laPopPanel(p); IsTop=1;
- }else if(p->Mode) return LA_RUNNING;
- laWindowToLocal(0, p, &x, &y);
- }
- if (e->type == LA_L_MOUSE_DOWN && (!NoPrimaryUI) && e->x + e->y < p->W + p->H - LA_SCROLL_W*2){
- laUiItem *pui = 0; laUiList *suil = 0;laListHandle levels={0};
- laUiList *duil = la_DetectUiListRecursiveDeep(&p->UI, e->x, e->y, 10000, &pui, &suil, 0, 0, 0, &levels);
- while(duil=lstPopPointer(&levels));
- if (suil){
- uid->Ptr1 = suil; uid->Ptr2 = pui;
- uid->TargetIndexVali = 3;
- uid->LastX = e->x; uid->LastY = e->y;
- uid->On=(!pui || e->x>pui->R-LA_SCROLL_W-2*(*p->BT)->RM)?1:0;
- return LA_RUNNING;
- }
- }
- if(la_ScrollPanel(uid,p,e))return LA_RUNNING;
- if (!p->Mode || (IsTop && !uid->TargetIndexVali)){
- if(y<p->TitleBar.B){ ui = la_DetectUiItemRecursive(&p->TitleBar, x, y, 10000, &Locals, 0); }
- elif (!ui && (!NoPrimaryUI)){
- lstClearPointer(&Locals);
- ui = la_DetectUiItemRecursive(&p->UI, x, y, 10000, &Locals, 0);
- }
- }
- if (ui && !a->Child && ui->Type->OperatorType && !la_UiOperatorExists(ui)){
- laSetOperatorLocalizer(p);
- if (laInvokeUiP(a, ui->Type->OperatorType, e, ui, &Locals, 0) >= 0){ laRetriggerOperators(); }
- lstClearPointer(&Locals);
- //return LA_RUNNING;
- }
- lstClearPointer(&Locals);
-
- if (p->Mode && e->type&LA_MOUSE_EVENT && !uid->TargetIndexVali && !p->IsMenuPanel){
- if (e->x + e->y > p->W + p->H - LA_SCROLL_W*2){
- if((!a->Item.pPrev) && (!p->ShowCorner)){ p->ShowCorner=1; laSetWindowCursor(LA_CORNER); laRefreshWindow(); }
- if(e->type==LA_L_MOUSE_DOWN){ uid->TargetIndexVali = 2; uid->LastX=e->x;uid->LastY=e->y; }
- return LA_RUNNING;
- }else{
- if(p->ShowCorner){ p->ShowCorner=0; laSetWindowCursor(LA_ARROW); laRefreshWindow(); }
- if(e->type==LA_L_MOUSE_DOWN){ uid->TargetIndexVali = 1; uid->LastX=e->x;uid->LastY=e->y; return LA_RUNNING; }
- }
- }
- if (e->type == LA_MOUSEMOVE){
- if (uid->TargetIndexVali == 1){
- if (!p->SL && !p->SR) p->TX = p->X + e->x - uid->LastX;
- if (!p->ST && !p->SB) p->TY = p->Y + e->y - uid->LastY;
- laNotifyUsersPPPath(&p->PP, "position");
- la_EnsurePanelSnapping(p, MAIN.CurrentWindow->CW, MAIN.CurrentWindow->CH);
- laRecalcCurrentPanel();
- return LA_RUNNING;
- }elif (uid->TargetIndexVali == 2){
- p->TW += e->x - uid->LastX; p->TH += e->y - uid->LastY;
- uid->LastX = e->x; uid->LastY = e->y;
- p->BoundUi=0;
- laNotifyUsersPPPath(&p->PP, "size");
- la_EnsurePanelSnapping(p, MAIN.CurrentWindow->CW, MAIN.CurrentWindow->CH);
- laRecalcCurrentPanel();
- return LA_RUNNING;
- }elif (uid->TargetIndexVali == 3){
- laUiList *suil = uid->Ptr1; laUiItem *pui = uid->Ptr2;
- int IsVertical=uid->On;
- uid->TargetIndexValf+=IsVertical?la_ScrollerVerticalPan(e->y - uid->LastY, p, uid->Ptr1, uid->Ptr2):
- (pui?la_ScrollerHorizontalPan(e->x - uid->LastX, p, uid->Ptr1, uid->Ptr2):0);
- uid->Dragging = (int)uid->TargetIndexValf; uid->TargetIndexValf-=uid->Dragging;
- int pV=uid->Dragging*IsVertical, pH=uid->Dragging*(!IsVertical);
- if (!pui) laPanUiList(suil, pH, pV,0, p->W, suil->U, p->H-(*p->BT)->BM);
- else laPanUiList(suil, pH, pV, suil->L, pui->R-(suil->ScrollerShownV?(LA_SCROLL_W+(*p->BT)->RM):0),
- suil->U, pui->B-(*p->BT)->BM-(suil->ScrollerShownH?(LA_SCROLL_W+(*p->BT)->BM):0));
- uid->LastX = e->x; uid->LastY = e->y;
- laRedrawCurrentPanel();
- return LA_RUNNING;
- }
- }
- if (e->type == LA_L_MOUSE_UP){
- uid->TargetIndexVali = 0; laSetWindowCursor(LA_ARROW);
- return LA_RUNNING;
- }
- if(p->Mode&&e->type&LA_MOUSE_EVENT){ return LA_RUNNING; }
- return RET;
- }
- int OPMOD_MenuPanel(laOperator *a, laEvent *e){
- int x = e->x;
- int y = e->y;
- laPanel *p = a->Instance;
- laUiItem *ui;
- laListHandle Locals = {0};
- laGeneralUiExtraData *uid = a->CustomData;
- if(MAIN.DockingPanel){return LA_FINISHED; }
- int IsClose=laIsCloseToPanel(p,x,y);
- int IsIn=laIsInPanel(p, x, y);
- if(p->CloseWhenMovedOut && ((!IsClose) || (!IsIn && e->type==LA_TIME_IDLE) || e->type==LA_L_MOUSE_DOWN||e->type==LA_R_MOUSE_DOWN)){
- la_StopUiOperatorService(p);
- laDestroySinglePanel(p,0);
- return LA_FINISHED_PASS;
- }
- if (e->type == LA_ESCAPE_DOWN || (e->type == LA_L_MOUSE_DOWN && !IsIn)){
- laConfirmInt(a, 1, LA_CONFIRM_DATA);
- la_StopUiOperatorService(p);
- laDestroySinglePanel(p,0);
- return LA_FINISHED_PASS;
- }
- if(p->PanelTemplate && laKeyMapExecuteEvent(a, &p->PanelTemplate->KeyMap, e)) return LA_RUNNING_PASS;
- if (e->type == LA_L_MOUSE_DOWN && e->y < p->H - LA_SCROLL_W){
- laUiItem *pui = 0; laUiList *suil = 0;laListHandle levels={0};
- laUiList *duil = la_DetectUiListRecursiveDeep(p->MenuRefer?p->MenuRefer:&p->UI, e->x, e->y, 10000, &pui, &suil, 0, 0, 0, &levels);
- while(duil=lstPopPointer(&levels));
- if (suil){
- uid->Ptr1 = suil; uid->Ptr2 = pui;
- uid->TargetIndexVali = 3;
- uid->LastX = e->x; uid->LastY = e->y;
- uid->On=(!pui || e->x>pui->R-LA_SCROLL_W-2*(*p->BT)->RM)?1:0;
- return LA_RUNNING;
- }
- }
- if (e->type == LA_L_MOUSE_UP && uid->TargetIndexVali == 3){
- uid->TargetIndexVali = 0;
- return LA_RUNNING;
- }
- if(la_ScrollPanel(uid,p,e))return LA_RUNNING;
- if (e->type == LA_MOUSEMOVE){
- if (uid->TargetIndexVali == 3){
- laUiList *suil = uid->Ptr1; laUiItem *pui = uid->Ptr2;
- int IsVertical=uid->On;
- uid->TargetIndexValf+=IsVertical?la_ScrollerVerticalPan(e->y - uid->LastY, p, uid->Ptr1, uid->Ptr2):
- (pui?la_ScrollerHorizontalPan(e->x - uid->LastX, p, uid->Ptr1, uid->Ptr2):0);
- uid->Dragging = (int)uid->TargetIndexValf; uid->TargetIndexValf-=uid->Dragging;
- int pV=uid->Dragging*IsVertical, pH=uid->Dragging*(!IsVertical);
- if (!pui) laPanUiList(suil, pH, pV,0, p->W, suil->U, p->H-(*p->BT)->BM);
- else laPanUiList(suil, pH, pV, suil->L, pui->R-(suil->ScrollerShownV?(LA_SCROLL_W+(*p->BT)->RM):0),
- suil->U, pui->B-(*p->BT)->BM-(suil->ScrollerShownH?(LA_SCROLL_W+(*p->BT)->BM):0));
- uid->LastX = e->x; uid->LastY = e->y;
- laRedrawCurrentPanel();
- return LA_RUNNING;
- }
- }
- ui = la_DetectUiItemRecursive(&p->UI, x, y, 10000, &Locals, 0);
- if (!ui){
- lstClearPointer(&Locals);
- ui = la_DetectUiItemRecursive(p->MenuRefer, x, y, 10000, &Locals, 0);
- }
- if (ui && !la_UiOperatorExists(ui)){
- laSetOperatorLocalizer(p);
- laInvokeUiP(a, ui->Type->OperatorType, e, ui, &Locals, 0);
- }
- lstClearPointer(&Locals);
- if (a->ConfirmData){
- laConfirmInt(a, a->ConfirmData->IData, a->ConfirmData->Mode);
- la_StopUiOperatorService(p);
- laDestroySinglePanel(p,0);
- return LA_FINISHED_PASS;
- }
- return LA_RUNNING;
- }
- int OPMOD_ModalPanel(laOperator *a, laEvent *e){
- int x = e->x;
- int y = e->y;
- laPanel *p = a->Instance;
- laUiItem *ui = 0;
- laListHandle Locals = {0};
- laGeneralUiExtraData *uid = a->CustomData;
- if(MAIN.DockingPanel){return LA_FINISHED; }
- if (e->type == LA_KEY_DOWN && e->key==LA_KEY_ESCAPE){
- laConfirmInt(a, 0, LA_CONFIRM_CANCEL);
- la_StopUiOperatorService(p);
- laDestroySinglePanel(p,0);
- return LA_FINISHED_PASS;
- }
- if (a->ConfirmData){
- laConfirmSameDataIfAny(a);
- if (a->ConfirmData->Mode == LA_CONFIRM_DATA||a->ConfirmData->Mode==LA_CONFIRM_CUSTOM_STRING){
- return LA_RUNNING_PASS;
- }
- la_StopUiOperatorService(p);
- laDestroySinglePanel(p,0);
- return LA_FINISHED_PASS;
- }
- if (!laIsInPanel(p, e->x, e->y) && !uid->TargetIndexVali){
- if(e->type&LA_STATE_DOWN){
- p->AnimationRatio=0; p->AnimationMode=LA_PANEL_ANIMATION_FLASH; laRedrawCurrentPanel();
- }
- if(p->ShowCorner){ p->ShowCorner=0; laSetWindowCursor(LA_ARROW); laRefreshWindow(); } return LA_RUNNING;
- }
- if(p->PanelTemplate && laKeyMapExecuteEvent(a, &p->PanelTemplate->KeyMap, e)) return LA_RUNNING_PASS;
- if (e->type == LA_L_MOUSE_DOWN && e->y < p->H - LA_SCROLL_W){
- laUiItem *pui = 0; laUiList *suil = 0;laListHandle levels={0};
- laUiList *duil = la_DetectUiListRecursiveDeep(&p->UI, e->x, e->y, 10000, &pui, &suil, 0, 0, 0, &levels);
- while(duil=lstPopPointer(&levels));
- if (suil){
- uid->Ptr1 = suil; uid->Ptr2 = pui;
- uid->TargetIndexVali = 3;
- uid->LastX = e->x; uid->LastY = e->y;
- uid->On=(!pui || e->x>pui->R-LA_SCROLL_W-2*(*p->BT)->RM)?1:0;
- return LA_RUNNING;
- }
- }
- if(la_ScrollPanel(uid,p,e))return LA_RUNNING;
- if (!uid->TargetIndexVali){
- ui = la_DetectUiItemRecursive(&p->TitleBar, x, y, 10000, &Locals, 0);
- if (!ui){
- lstClearPointer(&Locals);
- ui = la_DetectUiItemRecursive(&p->UI, x, y, 10000, &Locals, 0);
- }
- }
- if (ui && !a->Child && ui->Type->OperatorType && !la_UiOperatorExists(ui)){
- laSetOperatorLocalizer(p);
- laInvokeUiP(a, ui->Type->OperatorType, e, ui, &Locals, 0);
- return LA_RUNNING;
- }
- lstClearPointer(&Locals);
- int insize=0; if (e->x + e->y > p->W + p->H - LA_SCROLL_W*2){ insize=1;
- if((!a->Item.pPrev) && (!p->ShowCorner)){ p->ShowCorner=1; laSetWindowCursor(LA_CORNER); laRefreshWindow(); }
- }else{ if(p->ShowCorner){ p->ShowCorner=0; laSetWindowCursor(LA_ARROW); laRefreshWindow(); } }
- if (e->type == LA_L_MOUSE_DOWN){
- uid->LastX = e->x;
- uid->LastY = e->y;
- if(insize){ uid->TargetIndexVali = 2; laSetWindowCursor(LA_CORNER); }
- else uid->TargetIndexVali = 1;
- return LA_RUNNING;
- }
- if (e->type == LA_MOUSEMOVE){
- if (uid->TargetIndexVali == 1){
- if (!p->SL && !p->SR) p->TX = p->X + e->x - uid->LastX;
- if (!p->ST && !p->SB) p->TY = p->Y + e->y - uid->LastY;
- laNotifyUsersPPPath(&p->PP, "position");
- la_EnsurePanelSnapping(p, MAIN.CurrentWindow->CW, MAIN.CurrentWindow->CH);
- laRecalcCurrentPanel();
- return LA_RUNNING;
- }elif (uid->TargetIndexVali == 2){
- p->TW += e->x - uid->LastX; p->TH += e->y - uid->LastY;
- uid->LastX = e->x; uid->LastY = e->y;
- p->BoundUi=0;
- laNotifyUsersPPPath(&p->PP, "size");
- la_EnsurePanelSnapping(p, MAIN.CurrentWindow->CW, MAIN.CurrentWindow->CH);
- laRecalcCurrentPanel();
- return LA_RUNNING;
- }elif (uid->TargetIndexVali == 3){
- laUiList *suil = uid->Ptr1; laUiItem *pui = uid->Ptr2;
- int IsVertical=uid->On;
- uid->TargetIndexValf+=IsVertical?la_ScrollerVerticalPan(e->y - uid->LastY, p, uid->Ptr1, uid->Ptr2):
- (pui?la_ScrollerHorizontalPan(e->x - uid->LastX, p, uid->Ptr1, uid->Ptr2):0);
- uid->Dragging = (int)uid->TargetIndexValf; uid->TargetIndexValf-=uid->Dragging;
- int pV=uid->Dragging*IsVertical, pH=uid->Dragging*(!IsVertical);
- if (!pui) laPanUiList(suil, pH, pV,0, p->W, suil->U, p->H-(*p->BT)->BM);
- else laPanUiList(suil, pH, pV, suil->L, pui->R-(suil->ScrollerShownV?(LA_SCROLL_W+(*p->BT)->RM):0),
- suil->U, pui->B-(*p->BT)->BM-(suil->ScrollerShownH?(LA_SCROLL_W+(*p->BT)->BM):0));
- uid->LastX = e->x; uid->LastY = e->y;
- laRedrawCurrentPanel();
- return LA_RUNNING;
- }
- if(uid->TargetIndexVali==2){laSetWindowCursor(LA_CORNER);}
- }
- if (e->type == LA_L_MOUSE_UP){
- uid->TargetIndexVali = 0; laSetWindowCursor(LA_ARROW);
- return LA_RUNNING;
- }
- return LA_RUNNING;
- }
- int OPCHK_IsPanel(laPropPack *This, laStringSplitor *ss){
- if (This && This->LastPs->p == _LA_PROP_PANEL) return 1;
- else{
- char *PanelInternalID = strGetArgumentString(ss, "panel_id");
- if (!PanelInternalID) return 0;
- else
- return 1;
- }
- return 0;
- }
- int OPCHK_IsPanelNoInstructions(laPropPack *This, laStringSplitor *ss){
- if (This && This->LastPs->p == _LA_PROP_PANEL) return 1;
- return 0;
- }
- int OPINV_HidePanel(laOperator *a, laEvent *e){
- laPanel *p = a->This?a->This->EndInstance:0;
- laHidePanelWithDissoveEffect(p);
- return LA_FINISHED;
- }
- int OPINV_ActivatePanel(laOperator *a, laEvent *e){
- laStringSplitor *ss = a->ExtraInstructionsP;
- char *TemplateID = strGetArgumentString(ss, "panel_id");
- if (!TemplateID) return LA_CANCELED;
- laActivatePanel(TemplateID, e->x, e->y);
- return LA_FINISHED;
- }
- int OPINV_PanPanel(laOperator *a, laEvent *e){
- laPanel *p = a->This?a->This->EndInstance:0;
- //laHidePanel(p);
- return LA_FINISHED;
- }
- int OPCHK_IsHyper(laPropPack *This, laStringSplitor *ss){
- if (This && This->LastPs->p->Container->Hyper) return 1;
- return 0;
- }
- int OPINV_ViewHyperData(laOperator *a, laEvent *e){
- char buf[2048]={0};
- memHyperInfo(a->This, buf);
- printf("%s",buf);
- return LA_FINISHED;
- }
- int OPINV_TranslationDumpMisMatch(laOperator *a, laEvent *e){
- transDumpMissMatchRecord("TranslationDump.txt");
- laEnableMessagePanel(a, 0, "OK", "Untranslated strings exported to TranslationDump.txt", e->x - 250, e->y - 10, 300, e);
- return LA_FINISHED;
- }
- int OPINV_RefreshScreens(laOperator *a, laEvent *e){
- #ifdef LA_LINUX
- la_GetDPI(MAIN.win);
- #endif
- #ifdef _WIN32
- la_GetDPI(MAIN.CurrentWindow);
- #endif
- return LA_FINISHED;
- }
- int OPINV_RemoveScreenConfig(laOperator *a, laEvent *e){
- if(!a->This || !a->This->EndInstance) return LA_FINISHED;
- laEnableYesNoPanel(0, 0, "Confirm?", "Will remove this screen entry", e->x, e->y, 200, e);
- return LA_RUNNING;
- }
- int OPMOD_RemoveScreenConfig(laOperator *a, laEvent *e){
- if(!a->This || !a->This->EndInstance) return LA_FINISHED; laScreen* s=a->This->EndInstance;
- if(a->ConfirmData){
- if(a->ConfirmData->Mode == LA_CONFIRM_OK){
- la_RemoveScreen(s); laNotifyUsers("la.user_preferences.screens");
- }
- return LA_FINISHED;
- }
- return LA_FINISHED;
- }
- int OPINV_OpenInternetLink(laOperator *a, laEvent *e){
- char *link = strGetArgumentString(a->ExtraInstructionsP, "link");
- if (link) laOpenInternetLink(link);
- return LA_FINISHED;
- }
- void laget_PanelTemplateCategory(void* rack_unused, laUiTemplate* uit, char* copy, char** ptr);
- void la_RegisterBuiltinOperators(){
- laPropContainer *pc; laProp *p;
- laOperatorType *at;
- laEnumProp *ep;
- laCreateOperatorType("LA_terminate_program", "Quit", "Terminate Program Immediately",
- OPCHK_TerminateProgram, 0, 0, OPINV_TerminateProgram, 0, U'⏻', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_undo", "Undo", "Undo from recorded data state", OPCHK_Undo, 0, 0, OPINV_Undo, 0, U'⮌', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_redo", "Redo", "Redo using recorded data state", OPCHK_Redo, 0, 0, OPINV_Redo, 0, U'⮎', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_refresh_screens", "Refresh Screens", "Refresh Screens", 0, 0, 0, OPINV_RefreshScreens, 0, U'⭯', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_remove_screen_config", "Remove Screen", "Remove this screen configuration", 0, 0, 0, OPINV_RemoveScreenConfig, OPMOD_RemoveScreenConfig, U'🞫', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_translation_dump", "Dump Untranslated Text", "Dump Untranslated Text To File", 0, 0, 0, OPINV_TranslationDumpMisMatch, 0, U'📥', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_open_internet_link", "Goto", "Open Internet Link", 0, 0, 0, OPINV_OpenInternetLink, 0, U'🌐', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_system_paste", "SYSWINDOW Paste", "Generate a syetem paste event", 0, 0, 0, OPINV_SystemPaste, 0, U'📋', LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
- laCreateOperatorType("LA_string_copy", "Copy", "Copy string to clip board", 0, 0, 0, OPINV_StringCopy, 0, U'🗍', LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
- laCreateOperatorType("LA_window_operator", "SYSWINDOW Operator", "Handle All Unhandled Events", 0, 0, 0, OPINV_Window, OPMOD_Window, U'🖦', LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
- at = laCreateOperatorType("LA_switch_layout", "Switch Layout", "Cycle All Layouts In Current SYSWINDOW", 0, 0, 0, OPINV_SwitchLayout, OPMOD_FinishOnData, U'↔', LA_ACTUATOR_SYSTEM);
- at->UiDefine=laui_LayoutCycle;
- at = laCreateOperatorType("LA_new_window", "New SYSWINDOW", "Create a new window", 0, 0, 0, OPINV_NewWindow, 0, U'🗗', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_combine_child_blocks", "Combine Child Block", "If Child Blocks Are Two Panel Blocks, Then Combine Them.",
- OPCHK_CombineChildBlocks, 0, 0, OPINV_CombineChildBlocks, 0, U'□' , LA_ACTUATOR_SYSTEM);
- at = laCreateOperatorType("LA_new_panel", "New Panel", "Create a new panel",
- 0, 0, 0, OPINV_NewPanel, OPMOD_NewPanel, U'🞆', LA_ACTUATOR_SYSTEM);
- pc = laDefineOperatorProps(at, 0);
- p = laAddSubGroup(pc, "template", "Template", "Template selection used to create the new panel", "panel_template", 0, 0, laui_TitleOnly, -1, laget_FirstPanelTemplate, laget_NewPanelGetActiveTemplate, laget_ListNext, 0, 0, laset_NewPanelSetTemplate,0,0);
- laSubGroupExtraFunctions(p,0,0,0,0,laget_PanelTemplateCategory);
- at->UiDefine=laui_PanelTemplateSelect;
- laCreateOperatorType("LA_block_fold_title", "Fold Title", "Fold the tile bar of the block", 0, 0, 0, OPINV_BlockFoldTitle, 0, U'⯅', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_block_maximize", "Maximize", "Maximize this block", 0, 0, 0, OPINV_BlockMaximize, 0, U'⮼', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_block_tear_off_panel", "Tear Off", "Tear off current panel in the block",
- OPCHK_BlockHasMorePanels, 0, 0, OPINV_BlockTearOffPanel, 0, U'🗗', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_block_close_panel", "Close Panel", "Close current panel in the block",
- OPCHK_BlockHasMorePanels, 0, 0, OPINV_BlockClosePanel, OPMOD_BlockClosePanel, U'🞫', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_canvas_ui_maximize", "Maximize", "Maximize this UI item", 0, 0, 0, OPINV_CanvasUiMaximize, 0, U'⮼', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_hide_menu_bar", "Hide Menu Bar", "Hide menu bar of the window", 0, 0, 0, OPINV_HideMenuBar, 0, U'⯅', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_fullscreen", "Fullscreen", "Switch full screen for the window",
- 0, 0, 0, OPINV_Fullscreen, 0, U'🡵', LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
- laCreateOperatorType("LA_new_layout", "New Layout", "Create a new layout in the window",
- 0, 0, 0, OPINV_NewLayout, 0, U'🞦', LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
- laCreateOperatorType("LA_remove_layout", "Remove Layout", "Remove current layout in the window",
- OPCHK_RemoveLayout, 0, 0, OPINV_RemoveLayout, 0, U'🞫', LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
- laCreateOperatorType("LA_panel_operator", "Panel Operator", "Handle Events On The Panel Level",
- 0, 0, OPEXT_Panel, OPINV_Panel, OPMOD_Panel, U'🖦', LA_EXTRA_TO_PANEL | LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
- laCreateOperatorType("LA_modal_panel_operator", "Modal Panel Operator", "Handle Events On Modal Panels Like Yes-No Boxes",
- 0, 0, OPEXT_Panel, OPINV_Panel, OPMOD_ModalPanel, U'🖦', LA_EXTRA_TO_PANEL | LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
- laCreateOperatorType("LA_menu_panel_operator", "Menu Panel Operator", "Handle Events On Menu Panel,Recieve And Dispatch Confirm Messages,Then Self-destroy.",
- 0, 0, OPEXT_Panel, OPINV_Panel, OPMOD_MenuPanel, U'🖦', LA_EXTRA_TO_PANEL | LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
- laCreateOperatorType("LA_panel_activator", "Panel Activator", "Show A Panel When Invoked.Need An Extra Argument[panel_id]",
- OPCHK_IsPanel, 0, 0, OPINV_ActivatePanel, 0, 0, LA_ACTUATOR_SYSTEM)
- ->ParseArgs = la_PanelActiviatorParser;
- laCreateOperatorType("LA_hide_panel", "Hide Panel", "Hide a panel",
- OPCHK_IsPanel, 0, 0, OPINV_HidePanel, 0, 0, LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_dock_panel", "Dock Panel", "Dock a panel",
- OPCHK_IsPanel, 0, 0, OPINV_DockPanel, 0, 0, LA_ACTUATOR_SYSTEM);
-
- laCreateOperatorType("LA_prop_restore_default", "Restore default value", "Restore property back to its default value", OPCHK_PropSetValue, 0, 0, OPINV_PropSetDefault, 0, U'⭯', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_prop_set_min", "Set Min Value", "Set property to its minimum value", OPCHK_PropSetValue, 0, 0, OPINV_PropSetMin, 0, 0, LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_prop_set_max", "Set Max Value", "Set property to its maximum value", OPCHK_PropSetValue, 0, 0, OPINV_PropSetMax, 0, 0, LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_string_set_default", "Set Default Value", "Set default string", OPCHK_StringSetValue, 0, 0, OPINV_PropSetDefault, 0, U'⭯', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_string_get_folder_path", "Get folder Path", "get folder path", OPCHK_StringSetValue, 0, 0, OPINV_StringGetFolderPath, OPMOD_StringGetFolderOrFilePath, U'📁', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_string_get_file_path", "Get folder Path", "get file path", OPCHK_StringSetValue, 0, 0, OPINV_StringGetFilePath, OPMOD_StringGetFolderOrFilePath, U'🖹', LA_ACTUATOR_SYSTEM);
-
- laCreateOperatorType("LA_collection_clear_selection", "Clear Selection", "Clear collection selection", OPCHK_CollectionSetValue, 0, 0, OPINV_CollectionClearSelection, 0, U'🧹', LA_ACTUATOR_SYSTEM);
-
- laCreateOperatorType("LA_prop_insert_key", "Insert Key Frame", "Insert key frame in the active action", OPCHK_PropInsertKey, 0, 0, OPINV_PropInsertKey, 0, U'🔑', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_view_hyper_data", "View Hyper Data", "Show Properties Of Specific Data Block", OPCHK_IsHyper, 0, 0, OPINV_ViewHyperData, 0, U'🛈', LA_ACTUATOR_SYSTEM);
-
- at = laCreateOperatorType("LA_file_dialog_new_directory", "New Directory", "New Directory", OPCHK_IsFileBrowser, 0, 0, OPINV_FileBrowserNewDirectory, OPMOD_FileBrowserNewDirectory, U'📁', LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
- at->UiDefine = laui_FileBrowserNewDirectory;
- laCreateOperatorType("LA_file_dialog_refresh", "Refresh", "Refresh List", OPCHK_IsFileBrowser, 0, 0, OPINV_FileBrowserRefresh, 0, U'🗘', LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
- laCreateOperatorType("LA_file_dialog_up", "Up", "Select Upper Folder Level", OPCHK_IsFileBrowser, 0, 0, OPINV_FileBrowserUpLevel, 0, U'🢰', LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
- laCreateOperatorType("LA_file_dialog_confirm", "Confirm", "Confirm selection", OPCHK_FileBrowserCanConfirm, 0, 0, OPINV_FileBrowserConfirm, OPMOD_FileBrowserConfirm, U'✔', LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
- at = laCreateOperatorType("LA_file_dialog", "File Dialog", "Do File Operations", 0, 0, OPEXT_FileBrowser, OPINV_FileBrowser, OPMOD_FileBrowser, U'🗐', LA_ACTUATOR_SYSTEM);
- pc = laDefineOperatorProps(at, 1);
- at->UiDefine = laui_FileBrowserFileList;
- _LA_PROP_FILE_BROWSER = pc;
- laAddStringProperty(pc, "path", "Path", "Directort path", 0, 0, 0, "/", 0, offsetof(laFileBrowser, Path), 0, 0, laset_FileBrowserPath, 0, LA_UDF_LOCAL);
- laAddStringProperty(pc, "file_name", "File Name", "File name", 0, 0, 0, 0, 0, offsetof(laFileBrowser, FileName), 0, 0, laset_FileBrowserFileName, 0, LA_UDF_LOCAL);
- laAddStringProperty(pc, "temp_str", "Temp String", "Temp string", 0, 0, 0, "", 0, offsetof(laFileBrowser, TempStr), 0, 0, 0, 0, LA_UDF_LOCAL);
- laAddStringProperty(pc, "filter_name", "Filter Name", "Filter file name", 0, 0, 0, 0, 0, offsetof(laFileBrowser, FilterName), 0, 0, laset_FileBrowserFilterName, 0, LA_UDF_LOCAL);
- laAddSubGroup(pc, "file_list", "File List", "List Of Files And Directories Under A Specific Path", "file_item",0,0,laui_FileBrowserFileItem, -1, 0, laget_FileBrowserActiveFile, 0, 0, 0, laset_FileBrowserSelectFile, offsetof(laFileBrowser, FileList), 0);
- laAddSubGroup(pc, "disk_list", "Disk List", "List Of All Logical Drives (In Windows)", "disk_item",0, 0, 0, -1, 0, 0, 0, 0, 0, laset_FileBrowserActiveDisk, offsetof(laFileBrowser, Disks), 0);
- laAddSubGroup(pc, "bookmarks", "Bookmarks", "Bookmarked directories in GTK3", "bookmarked_folder",0, 0, 0, -1, 0, 0, 0, laset_FileBrowserBookmark, 0, 0, offsetof(laFileBrowser, Bookmarks), 0);
- laAddSubGroup(pc, "available_extensions", "Available Extensions", "List of all available extensions", "la_extension_type",0, 0, 0, -1, laget_FileBrowserAcceptedExtensionsFrist, 0, laget_FileBrowserAcceptedExtensionsNext,laset_FileBrowserExtension,0,0,0,0);
- laAddIntProperty(pc,"use_type","Use Type","Use file type",0,0,0,0,0,0,0,0,offsetof(laFileBrowser,UseType),0,0,0,0,0,0,0,0,0,0,LA_READ_ONLY);
- ep = laAddEnumProperty(pc, "select_what", "Select What", "Select folder or file", 0, 0, 0, 0, 0, offsetof(laFileBrowser, SelectFolder), 0, 0, 0, 0, 0, 0, 0, 0, 0,LA_READ_ONLY);{
- laAddEnumItemAs(ep, "file", "File", "File", LA_FILE_SELECT_FILE, U'📁');
- laAddEnumItemAs(ep, "folder", "Folder", "Folder", LA_FILE_SELECT_FOLDER, U'🖹');
- }
- laAddOperatorProperty(pc, "new_directory", "New Directory", "Create a new directory", "LA_file_dialog_new_directory", U'📁', 0);
- laAddOperatorProperty(pc, "refresh", "Refresh", "Refresh file list", "LA_file_dialog_refresh", U'🗘', 0);
- laAddOperatorProperty(pc, "folder_up", "Up", "Select Upper Folder Level In File Browsers", "LA_file_dialog_up", U'🢰', 0);
- laAddOperatorProperty(pc, "confirm", "Confirm", "Confirm selection", "LA_file_dialog_confirm", U'✔', 0);
- p = laAddPropertyContainer("disk_item", "Disk Item", "A logical drive (in Windows)", 0, laui_FileBrowserDiskItem, 0, 0, 0, 1);{
- 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, "free_gb", "Free", "Disk Free Space Size In Gigabytes", 0, 0, "GB", 0, 0, 0, 0, 0, offsetof(laDiskItem, Free_GB), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,LA_READ_ONLY);
- }
- p = laAddPropertyContainer("file_item", "File Item", "A file item in a list", U'🖹', 0, 0, 0, 0, 0);{
- laAddStringProperty(p, "name", "Name", "The name of the file (with extension)", 0, 0, 0, 0, 0, offsetof(laFileItem, Name), 0, 0, 0, 0, LA_UDF_LOCAL);
- laAddIntProperty(p, "is_folder", "Is Folder", "File is a folder or actual file", 0, 0, 0, 1, 0, 0, 0, 0, offsetof(laFileItem, IsFolder), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,LA_READ_ONLY);
- laAddSubGroup(p, "time_modified", "Time Last Modified", "The Time When The File Was Last Modified", "time_info",0, 0, 0, offsetof(laFileItem, TimeModified), 0, 0, 0, 0, 0, 0, 0, LA_UDF_LOCAL);
- laAddIntProperty(p, "size", "Size", "File Size In Bytes", 0, 0, "Bytes", 0, 0, 0, 0, 0, offsetof(laFileItem, Size), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,LA_READ_ONLY);
- laAddStringProperty(p, "size_string", "Size String", "File size in convenient string", 0, 0, 0, 0, 0, 0, 0, laget_FileBrowserFileSizeString, 0, 0, LA_READ_ONLY);
- ep = laAddEnumProperty(p, "type", "Type", "General type of the file", 0, 0, 0, 0, 0, offsetof(laFileItem, Type), 0, 0, 0, 0, 0, 0, 0, 0, 0,LA_READ_ONLY);{
- laAddEnumItemAs(ep, "unknown", "Unknown", "Unknown/Uncategorized File Type", LA_FILETYPE_UNKNOWN, U'🖹');
- laAddEnumItemAs(ep, "udf", "UDF", "Uniform Data Format", LA_FILETYPE_UDF, U'📦');
- laAddEnumItemAs(ep, "document", "Document", "Document File", LA_FILETYPE_DOCUMENT, U'🖹');
- laAddEnumItemAs(ep, "image", "Image", "Image File", LA_FILETYPE_IMAGE, U'🖻');
- laAddEnumItemAs(ep, "audio", "Audio", "Audio File", LA_FILETYPE_AUDIO, U'𝄞');
- laAddEnumItemAs(ep, "video", "Video", "Video File", LA_FILETYPE_VIDEO, U'🎞');
- laAddEnumItemAs(ep, "compressed", "Compressed", "Compressed File", LA_FILETYPE_COMPRESSED, U'🗜');
- laAddEnumItemAs(ep, "font", "Font", "Font File", LA_FILETYPE_FONT, U'🗚');
- laAddEnumItemAs(ep, "vector", "Vector", "Vector File", LA_FILETYPE_VECTOR, U'🞎');
- laAddEnumItemAs(ep, "webpage", "Webpage", "Webpage", LA_FILETYPE_WEBPAGE, U'🌐');
- laAddEnumItemAs(ep, "meta", "Meta Data", "Meta Data Package", LA_FILETYPE_META, U'🖹');
- laAddEnumItemAs(ep, "blend", "Blend", "Blend File", LA_FILETYPE_BLEND, U'🖹');
- laAddEnumItemAs(ep, "pdf", "PDF", "PDF File", LA_FILETYPE_PDF, U'🖹');
- laAddEnumItemAs(ep, "exe", "Executable", "SYSWINDOW Executable", LA_FILETYPE_EXEC, U'🖦');
- laAddEnumItemAs(ep, "sys", "System", "System Files", LA_FILETYPE_SYS, U'🖹');
- laAddEnumItemAs(ep, "folder", "Folder", "Folder", LA_FILETYPE_FOLDER, U'📁');
- laAddEnumItemAs(ep, "lasdexchange", "LaSDExchange", "LA Scene Descriptive Exchange File", LA_FILETYPE_LASDEXCHANGE, 0);
- }
- }
- p = laAddPropertyContainer("bookmarked_folder", "Bookmarked_folder", "A bookmarked folder from GTK3", 0, laui_IdentifierOnly, sizeof(laBookmarkedFolder), 0, 0, 0);{
- laAddStringProperty(p, "name", "Name", "Bookmark name", 0, 0, 0, 0, 0, offsetof(laBookmarkedFolder, Name), 0, 0, 0, 0, LA_AS_IDENTIFIER|LA_UDF_LOCAL);
- laAddStringProperty(p, "path", "Path", "Bookmark path", 0, 0, 0, 0, 0, offsetof(laBookmarkedFolder, Path), 0, 0, 0, 0, LA_UDF_LOCAL);
- }
- ep = laAddEnumProperty(pc, "show_backups", "Show Backups", "Show backup files", 0, 0, 0, 0, 0, offsetof(laFileBrowser, ShowBackups), 0, laset_FileBrowserShowBackups, 0, 0, 0, 0, 0, 0, 0,0);{
- laAddEnumItemAs(ep, "NONE", "None", "Don't show backup files", 0, U'~');
- laAddEnumItemAs(ep, "SHOWN", "Shown", "Show backup files", 1, U'~');
- }
- ep = laAddEnumProperty(pc, "show_thumbnail", "Show Thumbnail", "Show thumbnail", 0, 0, 0, 0, 0, offsetof(laFileBrowser, ShowThumbnail), 0, laset_FileBrowserShowThumbnail, 0, 0, 0, 0, 0, 0, 0,0);{
- laAddEnumItemAs(ep, "NONE", "None", "Don't show thumbnail files", 0, U'🖼');
- laAddEnumItemAs(ep, "SHOWN", "Shown", "Show thumbnail files", 1, U'🖼');
- }
- ep = laAddEnumProperty(pc, "sort_name", "Name", "Sort by names",LA_WIDGET_ENUM_CYCLE, 0, 0, 0, 0, 0, laget_FileBrowserSortName,laset_FileBrowserSortName, 0, 0, 0, 0, 0, 0, 0,0);{
- laAddEnumItemAs(ep, "NONE", "None", "Don't sort", 0, 0);
- laAddEnumItemAs(ep, "SORT", "Sort", "Sort accending", 1, U'🔻');
- laAddEnumItemAs(ep, "REV", "Reversed", "Sort Descending", 2, U'🔺');
- }
- ep = laAddEnumProperty(pc, "sort_time", "Time", "Sort by times",LA_WIDGET_ENUM_CYCLE, 0, 0, 0, 0, 0, laget_FileBrowserSortTime,laset_FileBrowserSortTime, 0, 0, 0, 0, 0, 0, 0,0);{
- laAddEnumItemAs(ep, "NONE", "None", "Don't sort", 0, 0);
- laAddEnumItemAs(ep, "SORT", "Sort", "Sort accending", 1, U'🔻');
- laAddEnumItemAs(ep, "REV", "Reversed", "Sort Descending", 2, U'🔺');
- }
- ep = laAddEnumProperty(pc, "sort_size", "Size", "Sort by sizes",LA_WIDGET_ENUM_CYCLE, 0, 0, 0, 0, 0, laget_FileBrowserSortSize,laset_FileBrowserSortSize, 0, 0, 0, 0, 0, 0, 0,0);{
- laAddEnumItemAs(ep, "NONE", "None", "Don't sort", 0, 0);
- laAddEnumItemAs(ep, "SORT", "Sort", "Sort accending", 1, U'🔻');
- laAddEnumItemAs(ep, "REV", "Reversed", "Sort Descending", 2, U'🔺');
- }
-
- at = laCreateOperatorType("LA_udf_read", "Read", "Read a UDF file", 0, 0, OPEXT_UDFOperation, OPINV_UDFRead, OPMOD_UDFRead, U'📑', LA_ACTUATOR_SYSTEM);
- pc = laDefineOperatorProps(at, 0);
- at->UiDefine = laui_LinkerPanel;
-
- at = laCreateOperatorType("LA_udf_save_instance", "Save Instance", "Save a instance as a UDF block", 0, 0, OPEXT_UDFOperation, OPINV_UDFSaveInstance, OPMOD_UDFSaveInstance, U'📑', LA_ACTUATOR_SYSTEM);
- at = laCreateOperatorType("LA_managed_save", "Save as", "Save managed data blocks", 0, 0, OPEXT_ManagedSave, OPINV_ManagedSave, OPMOD_ManagedSave, U'🖫', LA_ACTUATOR_SYSTEM);
- pc = laDefineOperatorProps(at, 1);
- ep=laAddEnumProperty(pc, "show_page", "Show Page", "Show whether data blocks or UDF files", 0,0,0,0,0,offsetof(laManagedSaveExtra, ShowPage),0,laset_ManagedSavePage,0,0,0,0,0,0,0,0);
- laAddEnumItemAs(ep, "DATA_BLOCKS", "Data Blocks", "All data blocks", 0, 0);
- laAddEnumItemAs(ep, "FILES", "Files", "All Files", 1, 0);
- at->UiDefine = laui_ManagedSavePanel;
-
- laCreateOperatorType("LA_udf_propagate", "Propagate", "Propagate this file to all unassigned child nodes", 0, 0, 0, OPINV_UDFPropagate, 0, 0, LA_ACTUATOR_SYSTEM);
-
- laCreateOperatorType("LA_managed_save_new_file", "New File", "New managed UDF file", 0, 0, OPEXT_ManagedSave, OPINV_ManagedSaveNewFile, OPMOD_ManagedSaveNewFile, U'+', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_manage_udf", "UDF Manager", "Operations on all managed UDF files", 0, 0, 0, OPINV_UDFManager, 0, U'🔍', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_add_resource_folder", "Add Resource Folder", "Add a resource folder entry for searching UDF references",
- 0, 0, 0, OPINV_AddResourceFolder, 0, U'🞧', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_remove_resource_folder", "Remove Resource Folder", "Remove a resource folder entry",
- 0, 0, 0, OPINV_RemoveResourceFolder, 0, U'🞫', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_new_input_mapping", "New Mapping", "New input mapping", 0, 0, 0, OPINV_NewInputMapping, 0, '+', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_new_input_mapping_entry", "New Entry", "New input mapping entry", 0, 0, 0, OPINV_NewInputMappingEntry, 0, '+', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_remove_input_mapping", "Remove Mapping", "Remove input mapping", 0, 0, 0, OPINV_RemoveInputMapping, OPMOD_RemoveInputMapping, U'🞫', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_remove_input_mapping_entry", "Remove Entry", "Remove input mapping entry", 0, 0, 0, OPINV_RemoveInputMappingEntry, OPMOD_RemoveInputMappingEntry, U'🞫', LA_ACTUATOR_SYSTEM);
- at = laCreateOperatorType("LA_input_mapping_entry_select_signal", "Select Signal", "Select signal for this entry", 0, 0, 0, OPINV_InputMappingEntrySelectSignal, OPMOD_InputMappingEntrySelectSignal, U'⯆', LA_ACTUATOR_SYSTEM);
- at->UiDefine = laui_InputMappingEntrySignalSelector;
- at = laCreateOperatorType("LA_input_mapping_entry_select_key", "Select Key", "Select key for this entry", 0, 0, OPEXT_InputMappingEntrySelectKey, OPINV_InputMappingEntrySelectKey, OPMOD_InputMappingEntrySelectKey, U'K', LA_ACTUATOR_SYSTEM);
- at->UiDefine = laui_InputMappingEntryKeySelector;
- pc = laDefineOperatorProps(at, 1);
- laAddStringProperty(pc,"pressed_string","Pressed String","String of the pressed key",LA_WIDGET_STRING_PLAIN,0,0,0,1,-1,0,laget_KeyDetectorPressedString,0,0,LA_READ_ONLY);
-
- laCreateOperatorType("LA_save_user_preferences", "Save Preferences", "Save user preferences", 0, 0, 0, OPINV_SaveUserPreferences, 0, 0, LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_restore_factory", "Restore Factory Settings", "Restore factory settings", 0, 0, 0, OPINV_RestoreFactorySettings, OPMOD_RestoreFactorySettings, 0, LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_confirm", "Confirm", "Confirm The Statement", 0, 0, 0, OPINV_DoNothing, 0, U'✔', LA_ACTUATOR_SYSTEM)
- ->ExtraInstructions = "feedback=CONFIRM;";
- laCreateOperatorType("LA_cancel", "Cancel", "Ignore The Statement", 0, 0, 0, OPINV_DoNothing, 0, U'🞫', LA_ACTUATOR_SYSTEM)
- ->ExtraInstructions = "feedback=CANCEL;";
- laCreateOperatorType("LA_pure_yes_no", "Yes Or No", "Show Yes Or No Box", 0, 0, 0, OPINV_PureYesNo, 0, U'❓', LA_ACTUATOR_SYSTEM);
-
- laCreateOperatorType("LA_delete_theme", "Delete Theme", "Delete a theme",
- 0, 0, 0, OPINV_DeleteTheme, 0, U'🞫', LA_ACTUATOR_SYSTEM);
- }
|