123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043 |
- #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;
- }
- 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(laFileItem *fi){
- char *format = strGetLastSegment(fi->Name, '.');
- DEFINE_FORMAT("udf", LA_FILETYPE_UDF);
- 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;
- }
- 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;
- long long FreeAvailable = 0;
- long long FreeSpace_UNUSED = 0;
- long long TotalSpace = 0;
- real Ratio = 0;
- if (fb->Path[len - 1] != L'/') strcat(fb->Path, "/");
-
- struct dirent **NameList=0;
- int NumFiles=scandir(fb->Path,&NameList,0,alphasort);
- 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;}
- 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){
- fi = memAcquireSimple(sizeof(laFileItem));
- strcpy(fi->Name, d->d_name);
- fi->Size = s.st_size;
- fi->Type = la_DetectFileItemType(fi);
- 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);
- }
- }
- lstCombineLists(&fb->FileList, &Files);
-
- for (int i=0;i<NumFiles;i++){ free(NameList[i]); } free(NameList);
- while (dl = lstPopItem(&fb->Disks))
- memFree(dl);
- //NumDisks = GetLogicalDriveStrings(256, DiskLabels) / 4;
- //while (*pd)
- //{
- // char Name[3] = "*:";
- // Name[0] = *pd;
- // if (GetDiskFreeSpaceEx(Name, &FreeAvailable, &TotalSpace, &FreeSpace_UNUSED))
- // {
- // dl = memAcquireSimple(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;
- //}
- fb->Active = 0;
- fb->FileName[0] = 0;
- }
- laFileBrowser *la_FileBrowserInit(laOperator *a){
- laFileBrowser *fb = memAcquireHyper(sizeof(laFileBrowser));
- strcpy(fb->Path, MAIN.WorkingDirectory->Ptr);
- if (strArgumentMatch(a->ExtraInstructionsP, "select", "folder")){ fb->SelectFolder = LA_FILE_SELECT_FOLDER; }
- if (strArgumentMatch(a->ExtraInstructionsP, "warn_file_exists", "true")){ fb->WarnFileExists = 1; }
- la_FileBrowserRebuildList(fb);
- return fb;
- }
- 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] != L'/') strcat(fb->Path, "/");
- strcat(fb->Path, fi->Name);
- la_FileBrowserRebuildList(fb);
- laRecalcCurrentPanelImmediate();
- }
- }else{
- if (!fi->IsFolder){
- strCopyFull(fb->FileName, fi->Name);
- }
- fb->Active = fi;
- }
- }
- void* la_FileBrowserGetFullPath(laFileBrowser *fb,char* buf){
- buf[0]=0;
- int plen;
- if (!fb->SelectFolder && fb->FileName[0] == L'\0') return;
- plen = strlen(fb->Path);
- if (fb->Path[plen - 1] != L'/') strcat(fb->Path, "/");
- strCopyFull(buf, fb->Path);
- strcat(buf, fb->FileName);
- }
- 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] = L':';
- result[2] = L'/';
- result[3] = L'\0';
- }
- void *laset_FileBrowserActiveDisk(laFileBrowser *fb, laDiskItem *di, int UNUSED_State){
- fb->RootDisk = di;
- laget_FileBrowserDiskID(di, fb->Path);
- la_FileBrowserRebuildList(fb);
- }
- void laset_FileBrowserPath(laFileBrowser *fb, char *content){
- strCopyFull(fb->Path, content);
- la_FileBrowserRebuildList(fb);
- laRecalcCurrentPanel();
- }
- void la_FileBrowserUpLevel(laFileBrowser *fb){
- char *p = fb->Path;
- char *LastP = 0;
- int Count = 0;
- for (p; *p; p++){
- if (*p && *p == L'/' && p[1]!=0){
- LastP = p;
- Count++;
- }
- }
- if (Count > 1) *LastP = 0;
- else if(LastP) *(LastP + 1) = 0;
- la_FileBrowserRebuildList(fb);
- }
- 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;
- }
- int OPEXT_FileBrowser(laOperator *a, int mark){
- memFree(a->CustomData);
- return 0;
- }
- 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->LastPs->UseInstance);
- laNotifyUsersPPPath(a->This, "path");
- laRecalcCurrentPanel();
- }
- return LA_FINISHED_PASS;
- }
- int OPCHK_FileBrowserCanConfirm(laPropPack *This, laStringSplitor *ss){
- if(!OPCHK_IsFileBrowser(This,ss)) return 0;
- laFileBrowser* fb=This->EndInstance;
- if(fb->SelectFolder) return 1;
- if(fb->FileName[0]) return 1;
- return 0;
- }
- int OPINV_FileBrowserConfirm(laOperator *a, laEvent *e){
- if (a->This){
- laFileBrowser* fb=a->This->LastPs->UseInstance;
- if(fb->WarnFileExists){
- char path[2048]; la_FileBrowserGetFullPath(fb, path);
- if(access(path, F_OK)==0){
- laEnableYesNoPanel(a,0,"File exists","Selected file already exists. Overwrite the file?",e->x-LA_RH,e->y-LA_RH,200,e);
- fb->StatusWaitingWarning=1; return LA_RUNNING;
- }
- }
- laConfirmInt(a, 0, LA_CONFIRM_OK); return LA_FINISHED_PASS;
- }
- return LA_FINISHED_PASS;
- }
- int OPMOD_FileBrowserConfirm(laOperator *a, laEvent *e){
- laFileBrowser* fb=a->This->LastPs->UseInstance;
- if (a->ConfirmData){
- if (a->ConfirmData->Mode == LA_CONFIRM_CANCEL){
- if(fb->StatusWaitingWarning){ fb->StatusWaitingWarning=0; return LA_FINISHED; }
- }
- if (a->ConfirmData->Mode == LA_CONFIRM_OK){
- laConfirmInt(a, 0, LA_CONFIRM_OK); return LA_FINISHED_PASS;
- }
- return LA_FINISHED;
- }
- return LA_RUNNING;
- }
- int OPEXT_UDFOperation(laOperator *a, laEvent *e){
- laUDFPreviewExtra *upe = a->CustomData;
- laUDFContentNode *ucni, *NextUCNI;
- for (ucni = upe->ContentNodes.pFirst; ucni; ucni = NextUCNI){
- NextUCNI = ucni->Item.pNext;
- la_FreePropStepCache(ucni->PP.Go);
- la_DestroyUDFContentNodeTreeRecursive(ucni, 1);
- }
- memFree(upe);
- }
- int OPINV_UDFAppend(laOperator *a, laEvent *e){
- laInvoke(a, "LA_file_dialog", e, 0, 0, 0);
- a->CustomData = memAcquireSimple(sizeof(laUDFPreviewExtra));
- return LA_RUNNING;
- }
- int OPMOD_UDFAppend(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){
- laExtractUDF(upe->UDF, m, LA_UDF_MODE_OVERWRITE, 0);
- laCloseUDF(upe->UDF);
- laRecordEverythingAndPush();
- return LA_FINISHED;
- }
- }
- return LA_FINISHED;
- }
- return LA_RUNNING;
- }
- void la_DestroyUDFContentNodeTreeRecursive(laUDFContentNode *ucn, int FreeRoot);
- 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);
- 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);
- }
- int 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;
- if(!empty){ laSaveManagedUDF(); 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, 0, 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,'/'));
- 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->LastPs->UseInstance) return LA_CANCELED;
- laResourceFolder* rf=a->This->LastPs->UseInstance;
- laRemoveResourceFolder(rf);
- laRefreshUDFRegistries();
- laNotifyUsers("la.user_preferences.resource_folders");
- return LA_FINISHED;
- }
- 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_SaveUserPreferences(laOperator *a, laEvent *e){
- laSaveUserPreferences(); return LA_FINISHED;
- }
- 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_IntSetValue(laPropPack *This, laStringSplitor *Instructions){
- if (This && (This->LastPs->p->PropertyType == LA_PROP_INT)) return 1;
- else
- return 0;
- }
- int OPCHK_FloatSetValue(laPropPack *This, laStringSplitor *Instructions){
- if (This && (This->LastPs->p->PropertyType == LA_PROP_FLOAT)) return 1;
- else
- return 0;
- }
- int OPCHK_IntArraySetValue(laPropPack *This, laStringSplitor *Instructions){
- if (This && (This->LastPs->p->PropertyType == LA_PROP_INT | LA_PROP_ARRAY)) return 1;
- else
- return 0;
- }
- int OPCHK_FloatArraySetValue(laPropPack *This, laStringSplitor *Instructions){
- if (This && (This->LastPs->p->PropertyType == LA_PROP_FLOAT | LA_PROP_ARRAY)) return 1;
- else
- return 0;
- }
- int OPCHK_EnumSetValue(laPropPack *This, laStringSplitor *Instructions){
- if (This && (This->LastPs->p->PropertyType == LA_PROP_ENUM)) return 1;
- else
- return 0;
- }
- int OPCHK_EnumArraySetValue(laPropPack *This, laStringSplitor *Instructions){
- if (This && (This->LastPs->p->PropertyType == LA_PROP_ENUM | LA_PROP_ARRAY)) return 1;
- else
- return 0;
- }
- int OPCHK_StringSetValue(laPropPack *This, laStringSplitor *Instructions){
- if (This && (This->LastPs->p->PropertyType == LA_PROP_STRING)) return 1;
- else
- return 0;
- }
- int OPINV_EnumSetDefault(laOperator *a, laEvent *e){
- if (a->This && (a->This->LastPs->p->PropertyType & LA_PROP_ENUM)){
- laEnumProp *ep = a->This->LastPs->p;
- laSetEnum(a->This, ep->DefVal);
- }
- return LA_FINISHED;
- }
- int OPINV_IntSetDefault(laOperator *a, laEvent *e){
- if (a->This && (a->This->LastPs->p->PropertyType & LA_PROP_INT)){
- laIntProp *ip = a->This->LastPs->p;
- laSetInt(a->This, ip->DefVal);
- }
- return LA_FINISHED;
- }
- int OPINV_FloatSetDefault(laOperator *a, laEvent *e){
- if (a->This && (a->This->LastPs->p->PropertyType & LA_PROP_FLOAT)){
- laFloatProp *ip = a->This->LastPs->p;
- laSetFloat(a->This, ip->DefVal);
- }
- return LA_FINISHED;
- }
- int OPINV_IntSetMax(laOperator *a, laEvent *e){
- if (a->This && (a->This->LastPs->p->PropertyType & LA_PROP_INT)){
- laIntProp *ip = a->This->LastPs->p;
- laSetInt(a->This, ip->Max);
- }
- return LA_FINISHED;
- }
- int OPINV_FloatSetMax(laOperator *a, laEvent *e){
- if (a->This && (a->This->LastPs->p->PropertyType & LA_PROP_FLOAT)){
- laFloatProp *ip = a->This->LastPs->p;
- laSetFloat(a->This, ip->Max);
- }
- return LA_FINISHED;
- }
- int OPINV_IntSetMin(laOperator *a, laEvent *e){
- if (a->This && (a->This->LastPs->p->PropertyType & LA_PROP_INT)){
- laIntProp *ip = a->This->LastPs->p;
- laSetInt(a->This, ip->Min);
- }
- return LA_FINISHED;
- }
- int OPINV_FloatSetMin(laOperator *a, laEvent *e){
- if (a->This && (a->This->LastPs->p->PropertyType & LA_PROP_FLOAT)){
- laFloatProp *ip = a->This->LastPs->p;
- laSetFloat(a->This, ip->Min);
- }
- return LA_FINISHED;
- }
- int OPINV_EnumArraySetDefault(laOperator *a, laEvent *e){
- if (a->This && (a->This->LastPs->p->PropertyType & LA_PROP_ENUM)){
- laEnumProp *ep = a->This->LastPs->p;
- laSetEnumArrayAll(a->This, ep->DefVal);
- }
- return LA_FINISHED;
- }
- int OPINV_IntArraySetDefault(laOperator *a, laEvent *e){
- if (a->This && (a->This->LastPs->p->PropertyType & LA_PROP_INT)){
- laIntProp *ip = a->This->LastPs->p;
- if (ip->DefArr) laSetIntArrayAllArray(a->This, ip->DefArr);
- else
- laSetIntArrayAll(a->This, ip->DefVal);
- }
- return LA_FINISHED;
- }
- int OPINV_FloatArraySetDefault(laOperator *a, laEvent *e){
- if (a->This && (a->This->LastPs->p->PropertyType & LA_PROP_FLOAT)){
- laFloatProp *ip = a->This->LastPs->p;
- if (ip->DefArr) laSetFloatArrayAllArray(a->This, ip->DefArr);
- else
- laSetFloatArrayAll(a->This, ip->DefVal);
- }
- return LA_FINISHED;
- }
- int OPINV_IntArraySetMax(laOperator *a, laEvent *e){
- if (a->This && (a->This->LastPs->p->PropertyType & LA_PROP_INT)){
- laIntProp *ip = a->This->LastPs->p;
- laSetIntArrayAll(a->This, ip->Max);
- }
- return LA_FINISHED;
- }
- int OPINV_FloatArraySetMax(laOperator *a, laEvent *e){
- if (a->This && (a->This->LastPs->p->PropertyType & LA_PROP_FLOAT)){
- laFloatProp *ip = a->This->LastPs->p;
- laSetFloatArrayAll(a->This, ip->Max);
- }
- return LA_FINISHED;
- }
- int OPINV_IntArraySetMin(laOperator *a, laEvent *e){
- if (a->This && (a->This->LastPs->p->PropertyType & LA_PROP_INT)){
- laIntProp *ip = a->This->LastPs->p;
- laSetIntArrayAll(a->This, ip->Min);
- }
- return LA_FINISHED;
- }
- int OPINV_FloatArraySetMin(laOperator *a, laEvent *e){
- if (a->This && (a->This->LastPs->p->PropertyType & LA_PROP_FLOAT)){
- laFloatProp *ip = a->This->LastPs->p;
- laSetFloatArrayAll(a->This, ip->Min);
- }
- return LA_FINISHED;
- }
- int OPINV_StringSetDefault(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 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_SubPutDataBlock(laPropPack *This, laStringSplitor *Instructions){
- //laListItem* Inst;
- //void* Actuall=0;
- //laProp* p;
- //if (!MAIN.RestoreInstance || !This || !Instructions) return 0;
- //p = la_PropLookup(&This->LastPs->p->SubProp->Props, strGetArgumentString(Instructions, "identifier"));
- //if (!p) return 0;
- //for (Inst = &p->SubProp->TrashBin.pFirst; Inst; Inst = Inst->pNext) {
- // if (Inst == MAIN.RestoreInstance) {
- // Actuall = Inst; break;
- // }
- //}
- //if(!Actuall)
- // for (Inst = &p->SubProp->FailedNodes.pFirst; Inst; Inst = Inst->pNext) {
- // if (Inst == MAIN.RestoreInstance) {
- // Actuall = Inst; break;
- // }
- // }
- //if (!Actuall) return 0;
- return 0;
- }
- int OPINV_SubPutDataBlock(laOperator *a, laEvent *e){
- //laProp* p = la_PropLookup(&a->This->LastPs->p->SubProp->Props, strGetArgumentString(a->ExtraInstructionsP, "identifier"));
- //lstRemoveItem(&p->SubProp->TrashBin, MAIN.RestoreInstance);
- //lstRemoveItem(&p->SubProp->FailedNodes, MAIN.RestoreInstance);
- ////laNotifySubPropUsers(p->SubProp, MAIN.RestoreInstance);
- //laAppendInstance(p, a->This->EndInstance, MAIN.RestoreInstance);
- //laNotifySubPropUsers(p, a->This->EndInstance);
- //laNotifySubPropUsers(_LA_PROP_TRASH_ITEM, p->SubProp);
- //laNotifySubPropUsers(_LA_PROP_FAILED_ITEM, p->SubProp);
- return LA_FINISHED;
- }
- int OPCHK_SubRestoreDataBlock(laPropPack *This, laStringSplitor *Instructions){
- if (This) return 1;
- return 0;
- }
- int OPINV_SubRestoreDataBlock(laOperator *a, laEvent *e){
- //if (a->This->EndInstance) {
- // MAIN.RestoreInstance = a->This->EndInstance;
- //}
- //laEnableOperatorPanel(a, 0, e->x, e->y, 600, 600, 2000, 1000, 100, 100, 0, 0, 0, 0, e);
- return LA_FINISHED; //will directly finish after actuator panel close or any feedback event and don't pass any feedback.
- }
- int OPEXT_SubRestoreDataBlock(laOperator *a, int unused){
- return 0;
- }
- 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;
- }
- 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;
- }
- int 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_NewLayout(laOperator *a, laEvent *e){
- laWindow* w=MAIN.CurrentWindow;
- laDesignLayout(w, "New Layout");
- laRedrawCurrentWindow();
- return LA_FINISHED;
- }
- int OPINV_NewPanel(laOperator *a, laEvent *e){
- laNewPanelData* np= CreateNew(laNewPanelData);
- a->CustomData = np;
- laEnableOperatorPanel(a, 0, e->x-50,e->y-50,500,500,1000,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) return LA_CANCELED;
- if(a->ConfirmData->Mode == LA_CONFIRM_DATA){
- if (!np || !np->SelectedTemplate) 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,400,400,0,0,0,0,0,0,0,0);
- }
- laShowPanelWithExpandEffect(p); laPopPanel(p); free(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->Panels.pFirst == b->Panels.pLast) return 0;
- return 1;
- }
- int OPINV_BlockClosePanel(laOperator *a, laEvent *e){
- laPanel*p = a->This?a->This->LastPs->UseInstance: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->LastPs->UseInstance: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->CW,w->CH);
- 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;
- w->CurrentLayout=nextl; lstRemoveItem(&w->Layouts, l); lstAppendItem(&nw->Layouts, l); nw->CurrentLayout=l;
- laRenameWindow(nw, l->ID->Ptr);
- laRenameWindow(w, w->CurrentLayout->ID->Ptr);
- }else{
- laDesignLayout(nw, "Empty Layout");
- }
- 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->Header){
- laShowLabel(uil, c, "Panel properties:", 0, 0);
- forp->PanelTemplate->Header(uil, &forp->PP, &forp->PropLinkPP, c, 0);
- }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) > 30 || abs(e->y - uid->LastY) > 30){
- if (MAIN.CurrentWindow->CurrentLayout->ClickedPanel){
- l = MAIN.CurrentWindow->CurrentLayout;
- l->DropToBlock = b;
- l->DropLocation = la_DetectBlockDropLocation(b, e->x, e->y);
- }
- }
- }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{
- b->OnButton=1;Ret=0;
- if(laIsInBlockBotton1(b, e->x, e->y)){ b->OnButton=2; if(e->Type==LA_L_MOUSE_DOWN){laUnfoldBlockTitle(b);Executed=1;Ret=1;} }
- elif(laIsInBlockBotton2(b, e->x, e->y)){ b->OnButton=2; if(e->Type==LA_L_MOUSE_DOWN){laMaximizeBlock(b);Executed=1;Ret=1;} }
- }
- if (Executed){
- b->CurrentPanel->Refresh |= LA_TAG_RECALC;
- 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{
- b->OnButton=0;
- }
- 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) ob->B1->CurrentPanel->Refresh |= LA_TAG_RECALC;
- if (ob->B2->CurrentPanel) ob->B2->CurrentPanel->Refresh |= LA_TAG_RECALC;
- return 1;
- }
- if (ob = la_OnBlockSeperator(b, e)){
- ob->B1->OnButton=ob->B2->OnButton=0;
- l->MovingBlock = ob;
- 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;
- }
- l->MovingBlock = 0;
- 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;
- laProp *p, *gp;
- c = laFirstColumn(uil);
-
- laShowItemFull(uil, c, 0, "la.windows.layouts", 0, 0, laui_IdentifierOnly, 0);
- laShowItem(uil, c, 0, "LA_new_layout");
- }
- 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;
- }
- if (strSame(strGetArgumentString(a->ExtraInstructionsP, "reverse"), "true")) w->CurrentLayout = w->CurrentLayout->Item.pPrev ? w->CurrentLayout->Item.pPrev : w->Layouts.pLast;
- else w->CurrentLayout = w->CurrentLayout->Item.pNext ? w->CurrentLayout->Item.pNext : w->Layouts.pFirst;
- laRenameWindow(w, w->CurrentLayout->ID->Ptr);
- la_StopAllOperators();
- laRetriggerOperators();
- 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){
- XConvertSelection(MAIN.dpy, MAIN.bufid, MAIN.fmtid, MAIN.propid, w->win, CurrentTime);
- }
- 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);
- }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(0);
- 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{
- 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);
- 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;
- }
- int OPEXT_Panel(laOperator *a, int ExitCode){
- memFree(a->CustomData);
- return 0;
- }
- 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->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)){
- 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 (p->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){
- if (!p->IsMenuPanel && e->x + e->y > p->W + p->H - LA_SCROLL_W*2){
- if(e->Type==LA_L_MOUSE_DOWN){ uid->TargetIndexVali = 2; uid->LastX=e->x;uid->LastY=e->y;}
- return LA_RUNNING;
- }else{
- 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;
- 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) 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);
- if (e->Type == LA_L_MOUSE_DOWN){
- uid->LastX = e->x;
- uid->LastY = e->y;
- if (e->x + e->y > p->W + p->H - LA_SCROLL_W*2) uid->TargetIndexVali = 2;
- 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 (e->Type == LA_L_MOUSE_UP){
- uid->TargetIndexVali = 0;
- 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->LastPs->UseInstance;
- 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->LastPs->UseInstance;
- //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_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, L'⏻', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_undo", "Undo", "Undo from recorded data state", 0, 0, 0, OPINV_Undo, 0, L'⮌', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_redo", "Redo", "Redo using recorded data state", 0, 0, 0, OPINV_Redo, 0, L'⮎', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_translation_dump", "Dump Untranslated Text", "Dump Untranslated Text To File", 0, 0, 0, OPINV_TranslationDumpMisMatch, 0, L'📥', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_open_internet_link", "Goto", "Open Internet Link", 0, 0, 0, OPINV_OpenInternetLink, 0, L'🌐', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_system_paste", "Window Paste", "Generate a syetem paste event", 0, 0, 0, OPINV_SystemPaste, 0, L'📋', LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
- laCreateOperatorType("LA_string_copy", "Copy", "Copy string to clip board", 0, 0, 0, OPINV_StringCopy, 0, L'🗍', LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
- laCreateOperatorType("LA_window_operator", "Window Operator", "Handle All Unhandled Events", 0, 0, 0, OPINV_Window, OPMOD_Window, L'🖦', LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
- at = laCreateOperatorType("LA_switch_layout", "Switch Layout", "Cycle All Layouts In Current Window", 0, 0, 0, OPINV_SwitchLayout, OPMOD_FinishOnData, L'↔', LA_ACTUATOR_SYSTEM);
- at->UiDefine=laui_LayoutCycle;
- at = laCreateOperatorType("LA_new_window", "New Window", "Create a new window", 0, 0, 0, OPINV_NewWindow, 0, L'🗗', 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, L'□' , LA_ACTUATOR_SYSTEM);
- at = laCreateOperatorType("LA_new_panel", "New Panel", "Create a new panel",
- 0, 0, 0, OPINV_NewPanel, OPMOD_NewPanel, L'🞆', 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,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, L'⯅', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_block_maximize", "Maximize", "Maximize this block", 0, 0, 0, OPINV_BlockMaximize, 0, L'⮼', 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, L'🗗', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_block_close_panel", "Close Panel", "Close current panel in the block",
- OPCHK_BlockHasMorePanels, 0, 0, OPINV_BlockClosePanel, OPMOD_BlockClosePanel, L'❌', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_canvas_ui_maximize", "Maximize", "Maximize this UI item", 0, 0, 0, OPINV_CanvasUiMaximize, 0, L'⮼', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_hide_menu_bar", "Hide Menu Bar", "Hide menu bar of the window", 0, 0, 0, OPINV_HideMenuBar, 0, L'⯅', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_new_layout", "New Layout", "Create a new layout in the window",
- 0, 0, 0, OPINV_NewLayout, 0, L'🞦', 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, L'🖦', 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, L'🖦', 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, L'🖦', 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_int_restore_default", "Restore Default Value", "Restore Int Value To Default", OPCHK_IntSetValue, 0, 0, OPINV_IntSetDefault, 0, L'⭯', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_real_restore_default", "Restore Default Value", "Restore Float Value To Default", OPCHK_FloatSetValue, 0, 0, OPINV_FloatSetDefault, 0, L'⭯', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_int_set_max", "Set Max Value", "Set Int Value To Max", OPCHK_IntSetValue, 0, 0, OPINV_IntSetMax, 0, 0, LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_real_set_max", "Set Max Value", "Set Float Value To Max", OPCHK_FloatSetValue, 0, 0, OPINV_FloatSetMax, 0, 0, LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_int_set_min", "Set Min Value", "Set Int Value To Min", OPCHK_IntSetValue, 0, 0, OPINV_IntSetMin, 0, 0, LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_real_set_min", "Set Min Value", "Set Float Value To Min", OPCHK_FloatSetValue, 0, 0, OPINV_FloatSetMin, 0, 0, LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_int_array_restore_default", "Restore Default Array/Value", "Restore Int Values To Default", OPCHK_IntArraySetValue, 0, 0, OPINV_IntArraySetDefault, 0, L'⭯', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_real_array_restore_default", "Restore Default Array/Value", "Restore Float Values To Default", OPCHK_FloatArraySetValue, 0, 0, OPINV_FloatArraySetDefault, 0, L'⭯', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_int_array_set_max", "Set Max Values", "Set Int Values To Max", OPCHK_IntArraySetValue, 0, 0, OPINV_IntArraySetMax, 0, 0, LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_real_array_set_max", "Set Max Values", "Set Float Values To Max", OPCHK_FloatArraySetValue, 0, 0, OPINV_FloatArraySetMax, 0, 0, LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_int_array_set_min", "Set Min Values", "Set Int Values To Min", OPCHK_IntArraySetValue, 0, 0, OPINV_IntArraySetMin, 0, 0, LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_real_array_set_min", "Set Min Values", "Set Float Values To Min", OPCHK_FloatArraySetValue, 0, 0, OPINV_FloatArraySetMin, 0, 0, LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_enum_restore_default", "Restore Default Value", "Restore enum value to default", OPCHK_EnumSetValue, 0, 0, OPINV_EnumSetDefault, 0, L'⭯', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_enum_array_restore_default", "Restore Default Array", "Restore enum array values to default", OPCHK_EnumArraySetValue, 0, 0, OPINV_EnumArraySetDefault, 0, L'⭯', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_string_set_default", "Set Default Value", "Set default string", OPCHK_StringSetValue, 0, 0, OPINV_StringSetDefault, 0, L'⭯', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_string_get_folder_path", "Get folder Path", "get folder path", OPCHK_StringSetValue, 0, 0, OPINV_StringGetFolderPath, OPMOD_StringGetFolderOrFilePath, L'📁', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_string_get_file_path", "Get folder Path", "get file path", OPCHK_StringSetValue, 0, 0, OPINV_StringGetFilePath, OPMOD_StringGetFolderOrFilePath, L'🖹', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_sub_put_data_block", "Put Data Block", "Put Pending Data Block Here",
- OPCHK_SubPutDataBlock, 0, 0, OPINV_SubPutDataBlock, 0, L'🡮', LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
- at = laCreateOperatorType("LA_sub_restore_data_block", "Put Data Block", "Put Pending Data Block Here",
- OPCHK_SubRestoreDataBlock, 0, OPEXT_SubRestoreDataBlock, OPINV_SubRestoreDataBlock, 0, L'🔗', LA_ACTUATOR_SYSTEM);
- at->UiDefine = laui_DataRestorePage;
- laCreateOperatorType("LA_view_hyper_data", "View Hyper Data", "Show Properties Of Specific Data Block", OPCHK_IsHyper, 0, 0, OPINV_ViewHyperData, 0, L'🛈', LA_ACTUATOR_SYSTEM);
-
- laCreateOperatorType("LA_file_dialog_up", "Up", "Select Upper Folder Level", OPCHK_IsFileBrowser, 0, 0, OPINV_FileBrowserUpLevel, 0, L'🢰', LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
- laCreateOperatorType("LA_file_dialog_confirm", "Confirm", "Confirm selection", OPCHK_FileBrowserCanConfirm, 0, 0, OPINV_FileBrowserConfirm, OPMOD_FileBrowserConfirm, L'✔', LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
- at = laCreateOperatorType("LA_file_dialog", "File Dialog", "Do File Operations", 0, 0, OPEXT_FileBrowser, OPINV_FileBrowser, OPMOD_FileBrowser, L'🗐', LA_ACTUATOR_SYSTEM);
- pc = laDefineOperatorProps(at, 2);
- 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, 0, 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, -offsetof(laFileBrowser, RootDisk), 0, 0, 0, 0, 0, laset_FileBrowserActiveDisk, offsetof(laFileBrowser, Disks), 0);
- 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, L'📁');
- laAddEnumItemAs(ep, "folder", "Folder", "Folder", LA_FILE_SELECT_FOLDER, L'🖹');
- }
- laAddOperatorProperty(pc, "folder_up", "Up", "Select Upper Folder Level In File Browsers", "LA_file_dialog_up", L'🢰', 0);
- laAddOperatorProperty(pc, "confirm", "Confirm", "Confirm selection", "LA_file_dialog_confirm", L'✔', 0);
- p = laAddPropertyContainer("disk_item", "Disk Item", "A Logical Drive (In Windows)", 0, laui_FileBrowserDiskItem, 0, 0, 0, 0);{
- 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", L'🖹', 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);
- 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, L'🖹');
- laAddEnumItemAs(ep, "udf", "UDF", "Uniform Data Format", LA_FILETYPE_UDF, L'📦');
- laAddEnumItemAs(ep, "document", "Document", "Document File", LA_FILETYPE_DOCUMENT, L'🖹');
- laAddEnumItemAs(ep, "image", "Image", "Image File", LA_FILETYPE_IMAGE, L'🖻');
- laAddEnumItemAs(ep, "audio", "Audio", "Audio File", LA_FILETYPE_AUDIO, L'𝄞');
- laAddEnumItemAs(ep, "video", "Video", "Video File", LA_FILETYPE_VIDEO, L'🎞');
- laAddEnumItemAs(ep, "compressed", "Compressed", "Compressed File", LA_FILETYPE_COMPRESSED, L'🗜');
- laAddEnumItemAs(ep, "font", "Font", "Font File", LA_FILETYPE_FONT, L'🗚');
- laAddEnumItemAs(ep, "vector", "Vector", "Vector File", LA_FILETYPE_VECTOR, L'🞎');
- laAddEnumItemAs(ep, "webpage", "Webpage", "Webpage", LA_FILETYPE_WEBPAGE, L'🌐');
- laAddEnumItemAs(ep, "meta", "Meta Data", "Meta Data Package", LA_FILETYPE_META, L'🖹');
- laAddEnumItemAs(ep, "blend", "Blend", "Blend File", LA_FILETYPE_BLEND, L'🖹');
- laAddEnumItemAs(ep, "pdf", "PDF", "PDF File", LA_FILETYPE_PDF, L'🖹');
- laAddEnumItemAs(ep, "exe", "Executable", "Window Executable", LA_FILETYPE_EXEC, L'🖦');
- laAddEnumItemAs(ep, "sys", "System", "System Files", LA_FILETYPE_SYS, L'🖹');
- laAddEnumItemAs(ep, "folder", "Folder", "Folder", LA_FILETYPE_FOLDER, L'📁');
- laAddEnumItemAs(ep, "lasdexchange", "LaSDExchange", "LA Scene Descriptive Exchange File", LA_FILETYPE_LASDEXCHANGE, 0);
- }
- }
- at = laCreateOperatorType("LA_udf_read", "Read", "Read a UDF file", 0, 0, OPEXT_UDFOperation, OPINV_UDFAppend, OPMOD_UDFAppend, L'📑', LA_ACTUATOR_SYSTEM);
- pc = laDefineOperatorProps(at, 0);
- at->UiDefine = laui_LinkerPanel;
- laAddSubGroup(pc, "root_nodes", "UDF Nodes", "List Of All Linkable/Appendable Nodes In The File", "udf_content_node",0, 0, laui_LinkerSelectionProp, -1, 0, 0, 0, 0, 0, 0, offsetof(laUDFPreviewExtra, ContentNodes), 0);
- at = laCreateOperatorType("LA_udf_save_instance", "Save Instance", "Save a instance as a UDF block", 0, 0, OPEXT_UDFOperation, OPINV_UDFSaveInstance, OPMOD_UDFSaveInstance, L'📑', LA_ACTUATOR_SYSTEM);
- at = laCreateOperatorType("LA_managed_save", "Managed Save", "Save managed data blocks", 0, 0, OPEXT_ManagedSave, OPINV_ManagedSave, OPMOD_ManagedSave, L'🖫', 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, L'+', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_manage_udf", "UDF Manager", "Operations on all managed UDF files", 0, 0, 0, OPINV_UDFManager, 0, L'🔍', 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, L'🞧', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_remove_resource_folder", "Remove Resource Folder", "Remove a resource folder entry",
- 0, 0, 0, OPINV_RemoveResourceFolder, 0, L'❌', LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_save_user_preferences", "Save Preferences", "Save user preferences", 0, 0, 0, OPINV_SaveUserPreferences, 0, 0, LA_ACTUATOR_SYSTEM);
- laCreateOperatorType("LA_confirm", "Confirm", "Confirm The Statement", 0, 0, 0, OPINV_DoNothing, 0, L'✔', LA_ACTUATOR_SYSTEM)
- ->ExtraInstructions = "feedback=CONFIRM;";
- laCreateOperatorType("LA_cancel", "Cancel", "Ignore The Statement", 0, 0, 0, OPINV_DoNothing, 0, L'❌', 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, L'❓', LA_ACTUATOR_SYSTEM);
-
- laCreateOperatorType("LA_delete_theme", "Delete Theme", "Delete a theme",
- 0, 0, 0, OPINV_DeleteTheme, 0, L'❌', LA_ACTUATOR_SYSTEM);
- }
|