123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582 |
- /*
- * 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 tnsMain* T;
- laWidget _LA_WIDGET_FIXED_GROUP={0};
- laWidget _LA_WIDGET_TAB={0};
- laWidget _LA_WIDGET_COLLECTION={0};
- laWidget _LA_WIDGET_COLLECTION_ITEM={0};
- laWidget _LA_WIDGET_COLLECTION_SELECTOR={0};
- laWidget _LA_WIDGET_COLLECTION_SINGLE={0};
- laWidget _LA_WIDGET_CONDITION_TOGGLE={0};
- laWidget _LA_WIDGET_COLUMN_ADJUSTER={0,LA_UI_FLAGS_NO_HEIGHT};
- laWidget _LA_WIDGET_COLUMN_VIEWER={0};
- laWidget _LA_WIDGET_BUTTON={0};
- laWidget _LA_WIDGET_BUTTON_NO_CONFIRM={0};
- laWidget _LA_WIDGET_LABEL={0};
- laWidget _LA_WIDGET_INT={0};
- laWidget _LA_WIDGET_INT_PLAIN={0, LA_UI_FLAGS_PLAIN};
- laWidget _LA_WIDGET_INT_PLAIN_ICON={0, LA_UI_FLAGS_INT_ICON};
- laWidget _LA_WIDGET_METER_TYPE1={0,LA_TEXT_ALIGN_CENTER};
- laWidget _LA_WIDGET_METER_TYPE2={0,LA_TEXT_ALIGN_CENTER};
- laWidget _LA_WIDGET_VALUE_METER_2D={0,LA_TEXT_ALIGN_CENTER};
- laWidget _LA_WIDGET_FLOAT={0};
- laWidget _LA_WIDGET_FLOAT_PLAIN={0, LA_UI_FLAGS_PLAIN};
- laWidget _LA_WIDGET_FLOAT_COLOR={0};
- laWidget _LA_WIDGET_FLOAT_COLOR_HCY={0};
- laWidget _LA_WIDGET_ENUM_SELECTOR={0};
- laWidget _LA_WIDGET_ENUM_SELECTOR_ICON={0, LA_UI_FLAGS_ICON};
- laWidget _LA_WIDGET_ENUM_CYCLE={0, LA_UI_FLAGS_CYCLE};
- laWidget _LA_WIDGET_ENUM_CYCLE_ICON={0, LA_UI_FLAGS_CYCLE|LA_UI_FLAGS_ICON};
- laWidget _LA_WIDGET_ENUM_ICON_PLAIN={0, LA_UI_FLAGS_PLAIN|LA_UI_FLAGS_ICON};
- laWidget _LA_WIDGET_ENUM_HIGHLIGHT={0, LA_UI_FLAGS_HIGHLIGHT|LA_UI_FLAGS_CYCLE|LA_TEXT_ALIGN_CENTER};
- laWidget _LA_WIDGET_STRING={0};
- laWidget _LA_WIDGET_STRING_PLAIN={0, LA_UI_FLAGS_PLAIN};
- laWidget _LA_WIDGET_STRING_MONO_PLAIN={0, LA_TEXT_MONO|LA_UI_FLAGS_PLAIN};
- laWidget _LA_WIDGET_STRING_MULTI={0, LA_TEXT_MONO};
- laWidget _LA_WIDGET_MENU_ROOT={0};
- laWidget _LA_WIDGET_ALIGN={0};
- laWidget _LA_WIDGET_3D_VIEW={0};
- laWidget _LA_WIDGET_2D_VIEW={0};
- laWidget _LA_WIDGET_SYMBOL={0};
- laWidget _LA_WIDGET_NODE_SOCKET={0};
- laWidget _LA_WIDGET_HEIGHT_ADJUSTER={0};
- laWidget _LA_WIDGET_RAW={0};
- laWidget _LA_WIDGET_MAPPER={0};
- laWidget _LA_WIDGET_IMAGE={0};
- laWidget _LA_WIDGET_SCOPE={0};
- laWidget _LA_WIDGET_KNOB={0,LA_UI_FLAGS_KNOB};
- laWidget *LA_WIDGET_FIXED_GROUP=&_LA_WIDGET_FIXED_GROUP;
- laWidget *LA_WIDGET_TAB=&_LA_WIDGET_TAB;
- laWidget *LA_WIDGET_COLLECTION=&_LA_WIDGET_COLLECTION;
- laWidget *LA_WIDGET_COLLECTION_ITEM=&_LA_WIDGET_COLLECTION_ITEM;
- laWidget *LA_WIDGET_COLLECTION_SELECTOR=&_LA_WIDGET_COLLECTION_SELECTOR;
- laWidget *LA_WIDGET_COLLECTION_SINGLE=&_LA_WIDGET_COLLECTION_SINGLE;
- laWidget *LA_WIDGET_CONDITION_TOGGLE=&_LA_WIDGET_CONDITION_TOGGLE;
- laWidget *LA_WIDGET_COLUMN_ADJUSTER=&_LA_WIDGET_COLUMN_ADJUSTER;
- laWidget *LA_WIDGET_COLUMN_VIEWER=&_LA_WIDGET_COLUMN_VIEWER;
- laWidget *LA_WIDGET_BUTTON=&_LA_WIDGET_BUTTON;
- laWidget *LA_WIDGET_BUTTON_NO_CONFIRM=&_LA_WIDGET_BUTTON_NO_CONFIRM;
- laWidget *LA_WIDGET_LABEL=&_LA_WIDGET_LABEL;
- laWidget *LA_WIDGET_INT=&_LA_WIDGET_INT;
- laWidget *LA_WIDGET_INT_PLAIN=&_LA_WIDGET_INT_PLAIN;
- laWidget *LA_WIDGET_INT_PLAIN_ICON=&_LA_WIDGET_INT_PLAIN_ICON;
- laWidget *LA_WIDGET_METER_TYPE1=&_LA_WIDGET_METER_TYPE1;
- laWidget *LA_WIDGET_METER_TYPE2=&_LA_WIDGET_METER_TYPE2;
- laWidget *LA_WIDGET_VALUE_METER_2D=&_LA_WIDGET_VALUE_METER_2D;
- laWidget *LA_WIDGET_FLOAT=&_LA_WIDGET_FLOAT;
- laWidget *LA_WIDGET_FLOAT_PLAIN=&_LA_WIDGET_FLOAT_PLAIN;
- laWidget *LA_WIDGET_FLOAT_COLOR=&_LA_WIDGET_FLOAT_COLOR;
- laWidget *LA_WIDGET_FLOAT_COLOR_HCY=&_LA_WIDGET_FLOAT_COLOR_HCY;
- laWidget *LA_WIDGET_ENUM_SELECTOR=&_LA_WIDGET_ENUM_SELECTOR;
- laWidget *LA_WIDGET_ENUM_SELECTOR_ICON=&_LA_WIDGET_ENUM_SELECTOR_ICON;
- laWidget *LA_WIDGET_ENUM_CYCLE=&_LA_WIDGET_ENUM_CYCLE;
- laWidget *LA_WIDGET_ENUM_CYCLE_ICON=&_LA_WIDGET_ENUM_CYCLE_ICON;
- laWidget *LA_WIDGET_ENUM_ICON_PLAIN=&_LA_WIDGET_ENUM_ICON_PLAIN;
- laWidget *LA_WIDGET_ENUM_HIGHLIGHT=&_LA_WIDGET_ENUM_HIGHLIGHT;
- laWidget *LA_WIDGET_STRING=&_LA_WIDGET_STRING;
- laWidget *LA_WIDGET_STRING_PLAIN=&_LA_WIDGET_STRING_PLAIN;
- laWidget *LA_WIDGET_STRING_MULTI=&_LA_WIDGET_STRING_MULTI;
- laWidget *LA_WIDGET_STRING_MONO_PLAIN=&_LA_WIDGET_STRING_MONO_PLAIN;
- laWidget *LA_WIDGET_MENU_ROOT=&_LA_WIDGET_MENU_ROOT;
- laWidget *LA_WIDGET_ALIGN=&_LA_WIDGET_ALIGN;
- laWidget *LA_WIDGET_3D_VIEW=&_LA_WIDGET_3D_VIEW;
- laWidget *LA_WIDGET_2D_VIEW=&_LA_WIDGET_2D_VIEW;
- laWidget *LA_WIDGET_SYMBOL=&_LA_WIDGET_SYMBOL;
- laWidget *LA_WIDGET_NODE_SOCKET=&_LA_WIDGET_NODE_SOCKET;
- laWidget *LA_WIDGET_HEIGHT_ADJUSTER=&_LA_WIDGET_HEIGHT_ADJUSTER;
- laWidget *LA_WIDGET_RAW=&_LA_WIDGET_RAW;
- laWidget *LA_WIDGET_MAPPER=&_LA_WIDGET_MAPPER;
- laWidget *LA_WIDGET_IMAGE=&_LA_WIDGET_IMAGE;
- laWidget *LA_WIDGET_SCOPE=&_LA_WIDGET_SCOPE;
- laWidget *LA_WIDGET_KNOB=&_LA_WIDGET_KNOB;
- //============================================== [Draw]
- int la_ArrayGetHeight(laUiItem *ui){
- return laGetArrayLength(&ui->PP);
- }
- int la_ValueGetHeight(laUiItem*ui){
- int rows = ui->Extra->HeightCoeff; TNS_CLAMP(rows,1,4);
- if(ui->Flags&LA_UI_FLAGS_TRANSPOSE){ return la_ArrayGetHeight(ui)*rows; }
- return rows;
- }
- int la_ValueMeterGetHeight(laUiItem*ui){
- if(ui->Flags&LA_UI_FLAGS_TRANSPOSE){ return ui->Extra->HeightCoeff?ui->Extra->HeightCoeff:6; }
- return laGetArrayLength(&ui->PP);
- }
- int la_ValueMeter2DGetHeight(laUiItem*ui){
- return ui->Extra->HeightCoeff?ui->Extra->HeightCoeff:(ui->Extra->HeightCoeff=(ui->TR-ui->TL)/LA_RH);
- }
- int la_CanvasGetHeight(laUiItem *ui){
- return ui->Expand;
- }
- int la_EnumGetHeight(laUiItem *ui){
- // norm e1
- // expand e1 e2 e3
- // expand vertical (vertical)
- // arr expand e1 e2 e3
- // e1 e2 e3
- // arr exp+vert e1 e1
- // e2 e2
- // e3 e3
- int IsVertical = ui->Flags&LA_UI_FLAGS_TRANSPOSE;
- int IsExpand = ui->Flags&LA_UI_FLAGS_EXPAND;
- int IsCycle = ui->Flags&LA_UI_FLAGS_CYCLE;
- int ArrLen = laGetArrayLength(&ui->PP);
- if(ArrLen==1){ if(!IsExpand) IsVertical=0; }else{ IsExpand=1; }
- int EnumLen = (IsExpand&&(!IsCycle)) ? laGetEnumEntryLen(&ui->PP) : 1;
- if(ArrLen==1){
- if(IsVertical&&IsExpand) return laGetEnumEntryLen(&ui->PP);
- return 1;
- }else{
- if(IsVertical) return EnumLen;
- else return ArrLen;
- }
- }
- int la_ColorPickerGetHeight(laUiItem *ui){
- if(!ui->Extra->HeightCoeff) ui->Extra->HeightCoeff=7;
- return ui->Extra->HeightCoeff;
- }
- int la_SymbolGetHeight(laUiItem *ui){
- //if (!ui->State)
- //{
- // ui->State = (int)_ICON_SYMBOL_SIZE[ui->SymbolID - ICON_SYMBOL_START] * 1.4 + 1;
- //}
- return ui->State;
- }
- int la_GroupGetHeight(laUiItem *ui){
- if (ui->State == LA_UI_ACTIVE) return 0;
- return LA_RH;
- }
- int la_StringPropGetHeight(laUiItem *ui){
- laBoxedTheme *bt = *ui->Type->Theme;
- if(!(ui->Flags&LA_TEXT_LINE_WRAP)) return 1;
- char _buf[LA_RAW_CSTR_MAX_LEN]={0}; char* buf=_buf;
- laGetString(&ui->PP, _buf, &buf); int rows=0;
- int strw=tnsStringGetDimension(buf, 0, 0, ui->TR-ui->TL, &rows, ui->Flags&LA_TEXT_MONO);
- return rows;
- }
- int la_MultiStringHeight(laUiItem *ui){
- laGeneralUiExtraData *e = ui->Extra;
- return e->HeightCoeff;
- }
- int la_LabelHeight(laUiItem *ui){
- int Wrap=ui->Flags&(LA_TEXT_USE_NEWLINE|LA_TEXT_LINE_WRAP);
- if(!Wrap) return 1;
- int rows;
- tnsStringGetDimension(transLate(ui->Display->Ptr), 0, 0, ui->TR-ui->TL, &rows, ui->Flags&LA_TEXT_MONO);
- return rows;
- }
- int la_SocketGetHeight(laUiItem *ui){
- if(ui->Flags&(LA_UI_SOCKET_LABEL_N|LA_UI_SOCKET_LABEL_S))return 2; return 1;
- }
- int la_ImageGetHeight(laUiItem *ui){
- tnsImage* im=ui->Extra;
- if(ui->Flags&LA_UI_IMAGE_FULL_W){
- if(!im->Texture){ return 1; }
- int W=im->Texture->Width, H=im->Texture->Height;
- real CW=MAIN.CurrentWindow->CW-LA_RH*4, CH=MAIN.CurrentWindow->CH-LA_RH*4;
- real ra=1;
- if(W>CW){ real r=W/CW; ra=TNS_MAX2(r,ra); }
- if(H>CH){ real r=H/CH; ra=TNS_MAX2(r,ra); }
- W/=ra; H/=ra;
- return H/LA_RH+1;
- }
- if(ui->SymbolID) return ui->SymbolID;
- return 1;
- }
- int la_ColorSelectorGetMinWidth(laUiItem *ui){
- if(ui->Flags&LA_UI_FLAGS_ICON) return LA_RH;
- return 5*LA_RH;
- }
- int la_ValueGetMinWidth(laUiItem *ui){
- int ExtraW=0;
- if(ui->Flags&LA_UI_FLAGS_NO_LABEL){ return LA_RH; }
- if(ui->Flags&LA_UI_FLAGS_KNOB){ return LA_RH*TNS_MAX2(1,ui->Extra->HeightCoeff); }
- if((ui->Flags&LA_UI_FLAGS_EXPAND)&&(!(ui->Flags&LA_UI_FLAGS_NO_LABEL))){
- ExtraW+=tnsStringGetWidth(transLate(ui->PP.LastPs->p->Name),0,0);
- }
- return LA_RH*4+ExtraW;
- }
- int la_LabelGetMinWidth(laUiItem *ui){
- laBoxedTheme *bt = *ui->Type->Theme;
- if(ui->Flags&LA_UI_MIN_WIDTH){ return LA_RH; }
- int strw=tnsStringGetWidth(transLate(SSTR(ui->Display)), 0, ui->Flags&LA_TEXT_MONO);
- if(ui->Type==_LA_UI_MENU_ROOT && strw<LA_RH)strw=LA_RH;
- return (strw + bt->LM + bt->RM);
- }
- int la_StringPropGetMinWidth(laUiItem *ui){
- laBoxedTheme *bt = *ui->Type->Theme;
- if(ui->Flags&LA_UI_MIN_WIDTH){ return LA_RH; }
- char _buf[LA_RAW_CSTR_MAX_LEN]={0}; int ExtraW=0; char* buf=_buf;
- if(ui->Type == _LA_UI_STRING_MULTI){ExtraW=2*LA_RH+bt->LM;}
- laGetString(&ui->PP, _buf, &buf); int rows=0;
- int strw=tnsStringGetDimension(buf, 0, 0, 0, &rows, ui->Flags&LA_TEXT_MONO);
- int Plain = ui->Flags&LA_UI_FLAGS_PLAIN;
- if((!Plain)&&strw<LA_RH*4){strw=LA_RH*4;}
- return (strw + bt->LM + bt->RM+ExtraW);
- }
- int la_EnumGetMinWidth(laUiItem *ui){
- laBoxedTheme *bt = *ui->Type->Theme;
- laEnumProp *ep = ui->PP.LastPs->p;
- laEnumItem *i;
- int W = 0; int tW;
- int IsVertical = ui->Flags&LA_UI_FLAGS_TRANSPOSE;
- int IsExpand = ui->Flags&LA_UI_FLAGS_EXPAND;
- int IsCycle = ui->Flags&LA_UI_FLAGS_CYCLE;
- int IsIcon = ui->Flags&LA_UI_FLAGS_ICON;
- int Highlight=ui->Flags&LA_UI_FLAGS_HIGHLIGHT;
- int NoDecal=ui->Flags&LA_UI_FLAGS_NO_DECAL;
- int SharedWidth;
- if(!IsIcon){
- SharedWidth = bt->LM + bt->RM + ((IsCycle||IsExpand||NoDecal)?0:LA_RH); int HasIcon=0;
- if(Highlight){ int ico=0;
- if (ui->ExtraInstructions){
- if (ui->Type->OperatorType->ParseArgs){
- char buf[256]; buf[0]=0;
- ui->Type->OperatorType->ParseArgs(ui->Instructions, &ico, buf);
- tW = tnsStringGetWidth(transLate(buf), 0, ui->Flags&LA_TEXT_MONO) + SharedWidth;
- }
- }else{
- for (i = ep->Items.pFirst; i; i = i->Item.pNext){ if (i->IconID){ HasIcon=1; } }
- tW = tnsStringGetWidth(transLate(ep->Base.Name), 0, ui->Flags&LA_TEXT_MONO) + SharedWidth;
- }
- if (tW > W) W = tW;
- if(HasIcon||ico) W+=bt->LM+LA_RH;
- }else{
- for (i = ep->Items.pFirst; i; i = i->Item.pNext){
- tW = tnsStringGetWidth(transLate(i->Name), 0, ui->Flags&LA_TEXT_MONO) + SharedWidth;
- if (i->IconID){ HasIcon=1; }
- if (tW > W) W = tW;
- }
- if(HasIcon) W+=bt->LM+LA_RH;
- }
- }else{
- W = LA_RH;
- }
- int ArrLen = laGetArrayLength(&ui->PP);
- if(ArrLen==1){ if(!IsExpand) IsVertical=0; }else{ IsExpand=1; }
- int EnumLen = (IsExpand&&(!IsCycle)) ? laGetEnumEntryLen(&ui->PP) : 1;
- if(ArrLen==1){
- if(!IsVertical) return W*EnumLen;
- return W;
- }else{
- if(IsVertical) return ArrLen*W;
- return EnumLen*W;
- }
- return W;
- }
- int la_ButtonGetMinWidth(laUiItem *ui){
- laBoxedTheme *bt = *ui->Type->Theme;
- uint32_t IconID;
- char buf[LA_RAW_CSTR_MAX_LEN]={0};
- char *label;
- laOperatorProp *ap;
- int IconOnly=ui->Flags&LA_UI_FLAGS_ICON;
- if(IconOnly) return LA_RH;
- if (ui->PP.LastPs && ui->PP.LastPs->p){
- ap = ui->PP.LastPs->p;
- label = transLate(ap->Base.Name);
- if (!ap->OperatorType) ap->OperatorType = laGetOperatorType(ap->OperatorID);
- IconID = ap->Base.IconID ? ap->Base.IconID : ap->OperatorType->IconID;
- }else{
- label = transLate(ui->AT->Name);
- IconID = ui->AT->IconID;
- }
- if (ui->ExtraInstructions){
- if (ui->AT && ui->AT->ParseArgs){
- ui->AT->ParseArgs(ui->Instructions, &IconID, buf);
- if (buf[0]) label = transLate(buf);
- }else if (ui->PP.LastPs->p->PropertyType == LA_PROP_OPERATOR){
- laOperatorProp *ap = ui->PP.LastPs->p;
- if (ap->OperatorType && ap->OperatorType->ParseArgs){
- ap->OperatorType->ParseArgs(ui->Instructions, &IconID, buf);
- if (buf[0]) label = transLate(buf);
- }
- }
- }
- int strw=tnsStringGetWidth(label, 0, ui->Flags&LA_TEXT_MONO);
- if(strw){ strw+=bt->RM+bt->LM; }
- return ((IconID ? (LA_RH) : 0) + strw);
- }
- int la_CollectionSimpleGetMinWidth(laUiItem *ui){
- laBoxedTheme *bt = *ui->Type->Theme;
- int Simple=ui->Flags&LA_UI_COLLECTION_SIMPLE_SELECTOR;
- int Expand=ui->Expand||(ui->Flags&LA_UI_FLAGS_EXPAND);
- int w=LA_RH+((Simple&&Expand)?(tnsStringGetWidth("Select",0,0)+bt->RM+bt->LM):0);
- return w;
- }
- int la_ColumnViewerGetMinWidth(laUiItem *ui){
- return 350;
- }
- int la_ColorPickerGetMinWidth(laUiItem *ui){
- return LA_RH * 9;
- }
- int la_SocketGetMinWidth(laUiItem *ui){
- if(ui->Flags&(LA_UI_SOCKET_LABEL_W|LA_UI_SOCKET_LABEL_E))return LA_RH*3;
- if(ui->Flags&(LA_UI_SOCKET_LABEL_S|LA_UI_SOCKET_LABEL_N))return LA_RH*2;
- return LA_RH;
- }
- int la_ImageGetMinWidth(laUiItem *ui){
- tnsImage* im=ui->Extra;
- if(!im->Texture) return LA_RH;
- int W=im->Texture->Width, H=im->Texture->Height;
- int UseW=LA_RH;
- if(ui->Flags&LA_UI_IMAGE_FULL_W) UseW=W;
- else UseW=(int)((real)LA_RH*ui->SymbolID/H*W);
- real CW=MAIN.CurrentWindow->CW-LA_RH*4, CH=MAIN.CurrentWindow->CH-LA_RH*4;
- real ra=1;
- if(UseW>CW){ real r=UseW/CW; ra=TNS_MAX2(r,ra); }
- if(H>CH){ real r=H/CH; ra=TNS_MAX2(r,ra); }
- UseW/=ra; H/=ra;
- return UseW;
- }
- void la_SingleLineStringDrawSelection(laUiItem *ui, int Begin, int U, laBoxedTheme *bt, uint32_t *str, laStringEdit *se);
- void la_CollectionSelectorDraw(laUiItem *ui, int h){
- char temp[128] = {0};
- laBoxedTheme *bt = (*ui->Type->Theme);
- real Color[16] = {0};
- tnsVector4d Transp = {0};
- int CrossDraw = 0;
- int Simple=ui->Flags&LA_UI_COLLECTION_SIMPLE_SELECTOR;
- if(Simple){ CrossDraw=0; }
- if (!ui->State) ui->State = LA_UI_NORMAL;
- tnsUseNoTexture();
- tnsColor4dv(laThemeColor(bt,ui->State));
- tnsVertex2d(ui->L, ui->U); tnsVertex2d(ui->R, ui->U);
- tnsVertex2d(ui->R, ui->B); tnsVertex2d(ui->L, ui->B);
- tnsPackAs(GL_TRIANGLE_FAN);
- if(!Simple){
- CrossDraw = laGetActiveInstanceStrict(ui->PP.LastPs->p, ui->PP.LastPs->UseInstance) ? 1 : 0;
- }
- if (CrossDraw){
- tnsVectorCopy4d(laThemeColor(bt,LA_BT_BORDER), Transp);
- Transp[3] = 0;
- tnsMakeLinerGradient4dv(Color, 2, Transp, laThemeColor(bt,LA_BT_BORDER));
- tnsMakeLinerGradient4dv(&Color[8], 2, Transp, laThemeColor(bt,LA_BT_BORDER));
- //tnsMakeLinerGradient4dv(&Color[8], 2, laThemeColor(bt, LA_BT_BORDER), Transp);
- tnsVertex2d(ui->R - LA_RH, ui->U); tnsVertex2d(ui->R, ui->U);
- tnsVertex2d(ui->R - LA_RH, ui->B); tnsVertex2d(ui->R, ui->B);
- tnsColorArray4d(Color, 4);
- tnsPackAs(GL_TRIANGLE_STRIP);
- }
- tnsColor4dv(laThemeColor(bt,LA_BT_BORDER));
- tnsVertex2d(ui->L, ui->U);
- tnsVertex2d(ui->R, ui->U);
- tnsVertex2d(ui->R, ui->B);
- tnsVertex2d(ui->L, ui->B);
- tnsPackAs(GL_LINE_LOOP);
- if (CrossDraw){
- tnsDrawStringAuto("🧹", laThemeColor(bt,ui->State|LA_BT_TEXT), ui->R - LA_RH, ui->R, ui->U, 0);
- }
- if(Simple){
- int R=ui->R; if(ui->Expand || (ui->Flags&LA_UI_FLAGS_EXPAND)){
- R=ui->L+LA_RH; tnsDrawStringAuto(transLate("Select"), laThemeColor(bt,ui->State|LA_BT_TEXT), R+bt->LM, ui->R, ui->U, 0);
- }
- tnsDrawStringAuto("⯆", laThemeColor(bt,ui->State|LA_BT_TEXT), ui->L, R, ui->U, LA_TEXT_ALIGN_CENTER);
- }
- }
- void la_EmptyDraw(laUiItem *ui, int h){
- char temp[128] = {0};
- laBoxedTheme *bt = (*ui->Type->Theme);
- if (!ui->State) ui->State = LA_UI_NORMAL;
- int NoDecal=ui->Flags&LA_UI_FLAGS_NO_DECAL;
- if(!NoDecal){
- tnsUseNoTexture();
- tnsColor4dv(laThemeColor(bt,LA_BT_NORMAL));
- tnsVertex2d(ui->L, ui->U);
- tnsVertex2d(ui->R, ui->U);
- tnsVertex2d(ui->R, ui->B);
- tnsVertex2d(ui->L, ui->B);
- tnsPackAs(GL_TRIANGLE_FAN);
- tnsColor4dv(laThemeColor(bt,LA_BT_BORDER));
- tnsVertex2d(ui->L, ui->U);
- tnsVertex2d(ui->R, ui->U);
- tnsVertex2d(ui->R, ui->B);
- tnsVertex2d(ui->L, ui->B);
- tnsPackAs(GL_LINE_LOOP);
- }
- }
- void la_GroupDraw(laUiItem *ui, int h){
- char temp[128] = {0};
- laBoxedTheme *bt = (*ui->Type->Theme);
- int NoDecal=ui->Flags&LA_UI_FLAGS_NO_DECAL;
- if(!NoDecal){
- tnsUseNoTexture();
- tnsColor4dv(laThemeColor(bt,LA_BT_NORMAL));
- tnsVertex2d(ui->L, ui->U);
- tnsVertex2d(ui->R, ui->U);
- tnsVertex2d(ui->R, ui->B);
- tnsVertex2d(ui->L, ui->B);
- tnsPackAs(GL_TRIANGLE_FAN);
- tnsColor4dv(laThemeColor(bt,LA_BT_BORDER));
- tnsVertex2d(ui->L, ui->U);
- tnsVertex2d(ui->R, ui->U);
- tnsVertex2d(ui->R, ui->B);
- tnsVertex2d(ui->L, ui->B);
- tnsPackAs(GL_LINE_LOOP);
- }
- if (ui->State != LA_UI_ACTIVE){
- tnsDrawStringAuto(ui->Page ? transLate(ui->Page->TabName->Ptr) : transLate("No Page"),
- laThemeColor(bt,ui->State|LA_BT_TEXT), ui->L+bt->LM, ui->R+bt->RM, ui->U, LA_TEXT_ALIGN_CENTER);
- }
- }
- void la_TabDraw(laUiItem *ui, int h){
- char temp[128] = {0};
- laBoxedTheme *bt = (*ui->Type->Theme);
- laUiList *uil; int count = 0, page = 0;real w, l = ui->L;
- for (uil = ui->Subs.pFirst; uil; uil = uil->Item.pNext){ count++; }
- w = (real)(ui->R - ui->L) / (count == 0 ? 1 : count);
- real* bkg=laThemeColor(bt,LA_BT_NORMAL);
- int NoDecal=ui->Flags&LA_UI_FLAGS_NO_DECAL;
- if(!NoDecal){
- tnsUseNoTexture();
- tnsColor4d(LA_COLOR3(bkg),bkg[3]*0.7);
- tnsVertex2d(ui->L, ui->U); tnsVertex2d(ui->R, ui->U);
- tnsVertex2d(ui->R, ui->B); tnsVertex2d(ui->L, ui->B);
- tnsPackAs(GL_TRIANGLE_FAN);
- real* bc=laThemeColor(bt,LA_BT_BORDER); real bcolor[24];
- tnsVectorCopy4d(bc,bcolor); tnsVectorSet4(&bcolor[4],bc[0],bc[1],bc[2],bc[3]*0.6);
- tnsVectorCopy4d(&bcolor[4],&bcolor[8]);
- tnsVectorCopy4d(&bcolor[4],&bcolor[12]);
- tnsVectorCopy4d(&bcolor[4],&bcolor[16]);
- tnsVectorCopy4d(bcolor,&bcolor[20]);
- tnsVertex2d(ui->L, ui->U + h); tnsVertex2d(ui->L, TNS_MIN2(ui->U+h*3,ui->B)); tnsVertex2d(ui->L, ui->B);
- tnsVertex2d(ui->R, ui->B); tnsVertex2d(ui->R, TNS_MIN2(ui->U+h*3,ui->B)); tnsVertex2d(ui->R, ui->U + h);
- tnsColorArray4d(bcolor,6);
- tnsPackAs(GL_LINE_STRIP);
- }
- for (uil = ui->Subs.pFirst; uil; uil = uil->Item.pNext){
- l = page*w; int IsThisPage=(uil==ui->Page);
- tnsUseNoTexture();
- if(!IsThisPage){
- tnsColor4dv(laThemeColor(bt,LA_BT_ACTIVE));
- tnsVertex2d(ui->L + l, ui->U); tnsVertex2d(ui->L + l + w, ui->U);
- tnsVertex2d(ui->L + l + w, ui->U + h); tnsVertex2d(ui->L + l, ui->U + h);
- tnsPackAs(GL_TRIANGLE_FAN);
- }
- tnsColor4dv(laThemeColor(bt,LA_BT_BORDER));
- tnsVertex2d(ui->L + l, ui->U + h); tnsVertex2d(ui->L + l, ui->U);
- tnsVertex2d(ui->L + l + w, ui->U); tnsVertex2d(ui->L + l + w, ui->U + h);
- tnsPackAs(IsThisPage?GL_LINE_STRIP:GL_LINE_LOOP);
- tnsDrawStringAuto(transLate(uil->TabName->Ptr), laThemeColor(bt,IsThisPage?LA_BT_BORDER:LA_BT_TEXT), ui->L+l+bt->LM, ui->L+l+w-bt->RM, ui->U, LA_TEXT_ALIGN_CENTER);
- page++;
- }
- tnsFlush();
- }
- void la_SymbolDraw(laUiItem *ui, int h){
- return;
- //char temp[128] = {0};
- //laBoxedTheme *bt = (*ui->Type->Theme);
- //tnsFontSingleCharacter *fsc = tfntFetchVectorGraphTextureIDW(ui->SymbolID);
- //int VOffset = (ui->B - ui->U - (fsc->height)) / 2;
- //int HOffset = (ui->R - ui->L - (fsc->width)) / 2;
- //
- //if (strArgumentMatch(ui->Instructions, "mode", "invert"))
- //{
- // tnsUseNoTexture();
- // //tnsColor4dv(laThemeColor(bt, ui->State));
- // //tnsVertex2d(ui->L, ui->U);
- // //tnsVertex2d(ui->R, ui->U);
- // //tnsVertex2d(ui->R, ui->B);
- // //tnsVertex2d(ui->L, ui->B);
- // //tnsPackAs(GL_TRIANGLE_FAN);
- //
- // tnsUseNoTexture();
- // tnsColor4dv(LA_THEME_GET(bt, LA_UI_NORMAL)->BorderColor->RGBA);
- // tnsVertex2d(ui->L, ui->U);
- // tnsVertex2d(ui->R, ui->U);
- // tnsVertex2d(ui->R, ui->B);
- // tnsVertex2d(ui->L, ui->B);
- // tnsPackAs(GL_TRIANGLE_FAN);
- //
- // // tnsDrawVectorGraphPackage(ui->SymbolID, LA_THEME_GET(bt, LA_THEME_INTERPOLATING), ui->L + HOffset, ui->R, ui->U + VOffset, ui->B, 0, 0);
- //}
- //else
- //{
- // //if (!ui->State) ui->State = LA_UI_NORMAL;
- //
- // /*tnsUseNoTexture();
- // tnsColor4dv(laThemeColor(bt, ui->State));
- // tnsVertex2d(ui->L, ui->U);
- // tnsVertex2d(ui->R, ui->U);
- // tnsVertex2d(ui->R, ui->B);
- // tnsVertex2d(ui->L, ui->B);
- // tnsPackAs(GL_TRIANGLE_FAN);*/
- //
- // //tnsUseNoTexture();
- //tnsColor4dv(LA_THEME_GET(bt, LA_UI_NORMAL)->BorderColor->RGBA);
- //tnsVertex2d(ui->L, ui->U);
- //tnsVertex2d(ui->R, ui->U);
- //tnsVertex2d(ui->R, ui->B);
- //tnsVertex2d(ui->L, ui->B);
- //tnsPackAs(GL_LINE_LOOP);
- //
- // // tnsDrawVectorGraphPackage(ui->SymbolID, LA_THEME_GET(bt, LA_UI_NORMAL), ui->L + HOffset, ui->R, ui->U + VOffset, ui->B, 0, 0);
- //}
- }
- void la_IntDraw(laUiItem *ui, int h){
- laBoxedTheme *bt = (*ui->Type->Theme);
- int Data[32];
- int Len, i, Seg, W;
- char buf[48] = {0};
- char buf2[48] = {0};
- char prefix[8][64] = {0};
- int Original;
- int Ranged;
- int min, max;
- int s, State;
- int IsVertical=ui->Flags&LA_UI_FLAGS_TRANSPOSE;
- int IsIcon=ui->Flags&LA_UI_FLAGS_ICON;
- int NoDecal=ui->Flags&LA_UI_FLAGS_NO_DECAL;
- int NoLabel=ui->Flags&LA_UI_FLAGS_NO_LABEL;
- int IsDisabled=ui->Flags&LA_UI_FLAGS_DISABLED;
- int IsKnob = ui->Flags&LA_UI_FLAGS_NODE_CONTAINER;
- if (laIsPropertyReadOnly(&ui->PP) && !NoDecal) ui->State = LA_BT_DISABLED;
- laGetIntArray(&ui->PP, Data);
- Len = laGetArrayLength(&ui->PP);
- laGetPrefixP(&ui->PP, prefix);
- Ranged = laGetIntRange(&ui->PP, &min, &max);
- for (i = 0; i < Len; i++){
- int _L=ui->L, _R=ui->R, _U=ui->U, _B=ui->B;
- if(IsVertical){
- Seg = ui->R - ui->L;
- _U = ui->U + i * LA_RH; _B = _U+LA_RH;
- }else{
- Seg = (ui->R - ui->L) / Len;
- _L = ui->L + i * Seg; _R=_L+Seg;
- }
- if(IsIcon){
- sprintf(buf, "%lc", laGetInt(&ui->PP));
- }else{
- buf[0] = '\0'; buf2[0] = '\0';
- if(Len==1){ strcat(buf2, transLate(ui->PP.LastPs->p->Name)); }
- if(i<8)strcat(Len==1?buf:buf2,&prefix[i]);
- strPrintIntAfter(buf, 48, Data[i]);
- strAppend(buf, ui->PP.LastPs->p->Unit ? transLate(ui->PP.LastPs->p->Unit) : "");
- }
- if (ui->Extra && ui->Extra->On == i + 1){
- Original = ui->State;
- ui->State = LA_UI_ACTIVE;
- }
- if(IsKnob && !ui->Extra->Edit){
- real ctrx = (real)(_L+_R)/2.0f, ctry=(real)(_U+_B)/2.0f, radius=TNS_MIN2((_B-_U)/2.0f,(_R-_L)/2.0f);
- tnsUseNoTexture();
- real dgx=0,dgy=0;
- if(radius*2>(_B-_U)-LA_RH/5){ dgx = radius/1.5; }
- if(radius*2>(_R-_L)-LA_RH/5){ dgy = radius/1.5; }
- tnsColor4dv(laThemeColor(bt,LA_BT_BORDER));
- tnsVertex2d(_L, ctry-dgy); tnsVertex2d(_L, _U); tnsVertex2d(ctrx-dgx, _U); tnsPackAs(GL_LINE_STRIP);
- tnsVertex2d(_R, ctry-dgy); tnsVertex2d(_R, _U); tnsVertex2d(ctrx+dgx, _U); tnsPackAs(GL_LINE_STRIP);
- tnsVertex2d(_R, ctry+dgy); tnsVertex2d(_R, _B); tnsVertex2d(ctrx+dgx, _B); tnsPackAs(GL_LINE_STRIP);
- tnsVertex2d(_L, ctry+dgy); tnsVertex2d(_L, _B); tnsVertex2d(ctrx-dgx, _B); tnsPackAs(GL_LINE_STRIP);
-
- real verts[52];//24*2+ctr+overlap
- tnsMakeCircle2d(&verts[2],24,ctrx,ctry,radius,0);
- tnsVectorCopy2d(&verts[2],&verts[50]);
- verts[0]=ctrx; verts[1]=ctry;
- tnsColor4dv(laThemeColor(bt,ui->State));
- tnsVertexArray2d(verts,26); tnsPackAs(GL_TRIANGLE_FAN);
- tnsMakeCircle2d(verts,24,ctrx,ctry,radius,0);
- tnsColor4dv(laThemeColor(bt,LA_BT_BORDER));
- tnsVertexArray2d(verts,24); tnsPackAs(GL_LINE_LOOP);
- if(Ranged){
- real arc[52]; int arcindex[26]; // 12 slices 13 ends
- real range = (real)(Data[i] - min) / (real)(max - min) * TNS_PI * 1.5;
- tnsMakeArc2d(arc,12,ctrx,ctry,radius,TNS_PI*2.75, TNS_PI*2.75 + range);
- tnsMakeArc2d(&arc[26],12,ctrx,ctry,radius*0.6,TNS_PI*2.75, TNS_PI*2.75 + range);
- tnsMakeBridgedIndex(arcindex, 13, 0, 0);
- real *color = laThemeColor(bt,LA_BT_TEXT|ui->State); //tnsColor4d(LA_COLOR3(color),0.3);
- tnsColor4dv(color);
- tnsVertexArray2d(arc,26); tnsIndexArray(arcindex,26); tnsPackAs(GL_TRIANGLE_STRIP);
- tnsMakeArc2d(&arc[2],12,ctrx,ctry,radius*0.6,TNS_PI*2.75, TNS_PI*4.25);
- tnsVertexArray2d(&arc[2],13);
- tnsColor4dv(laThemeColor(bt,LA_BT_BORDER));
- tnsPackAs(GL_LINE_STRIP);
- }
- }else{
- if(!NoDecal){
- tnsUseNoTexture();
- tnsColor4dv(laThemeColor(bt,ui->State));
- tnsVertex2d(_L, _U); tnsVertex2d(_R, _U);
- tnsVertex2d(_R, _B); tnsVertex2d(_L, _B);
- tnsPackAs(GL_TRIANGLE_FAN);
- if (Ranged){
- int L1 = _L;
- int R1 = (real)(Data[i] - min) / (real)(max - min) * (real)(Seg) + L1;
- tnsUseNoTexture(); real* color=laThemeColor(bt,LA_BT_TEXT);
- tnsColor4d(LA_COLOR3(color),0.3);
- tnsVertex2d(L1, _U); tnsVertex2d(R1, _U);
- tnsVertex2d(R1, _B); tnsVertex2d(L1, _B);
- tnsPackAs(GL_TRIANGLE_FAN);
- }
- tnsColor4dv(laThemeColor(bt,LA_BT_BORDER));
- tnsVertex2d(_L, _U); tnsVertex2d(_R, _U);
- tnsVertex2d(_R, _B); tnsVertex2d(_L, _B);
- tnsPackAs(GL_LINE_LOOP);
- }
- if (ui->Extra->On == i + 1 && ui->Extra->Edit){
- uint32_t *buf = strGetCursorLine(ui->Extra->Edit, 0)->Buf;
- int LL = _L + (Seg - tnsStringGetWidthU(buf, 0, ui->Flags&LA_TEXT_MONO)) / 2;
- tnsColor4dv(laThemeColor(bt, LA_BT_TEXT));
- la_SingleLineStringDrawSelection(ui, _L, _U, bt, buf, ui->Extra->Edit);
- tnsDrawStringM(0, buf, laThemeColor(bt, LA_BT_TEXT_ACTIVE), _L + bt->LM, _R - bt->RM, _U, ui->Flags);
- }else{
- tnsDrawStringWithPriority(NoLabel?0:buf2, buf,
- IsDisabled?laThemeColor(bt, LA_BT_DISABLED):laThemeColor(bt, LA_BT_TEXT|ui->State), bt->TextAlign, _L + bt->LM, _R - bt->RM, _U, ui->Flags);//, ui->ExtraInstructions);
- }
- }
- if (ui->Extra && ui->Extra->On == i + 1) ui->State = Original;
- }
- tnsFlush();
- }
- void la_FloatDraw(laUiItem *ui, int h){
- laBoxedTheme *bt = (*ui->Type->Theme);
- real Data[32];
- int Len, i, W, Seg;
- char buf[48] = {0};
- char buf2[48] = {0};
- char prefix[8][64] = {0};
- int Original;
- int Ranged;
- real min, max;
- int s, State;
- int IsVertical=ui->Flags&LA_UI_FLAGS_TRANSPOSE;
- int NoDecal=ui->Flags&LA_UI_FLAGS_NO_DECAL;
- int IsRad=ui->PP.LastPs->p->IsRadAngle;
- int NoLabel=ui->Flags&LA_UI_FLAGS_NO_LABEL;
- int IsDisabled=ui->Flags&LA_UI_FLAGS_DISABLED;
- int IsKnob = ui->Flags&LA_UI_FLAGS_NODE_CONTAINER;
- if (laIsPropertyReadOnly(&ui->PP) && !NoDecal) ui->State = LA_BT_DISABLED;
- laGetFloatArray(&ui->PP, Data);
- Len = laGetArrayLength(&ui->PP);
- laGetPrefixP(&ui->PP, prefix);
- Ranged = laGetFloatRange(&ui->PP, &min, &max);
- for (i = 0; i < Len; i++){
- int _L=ui->L, _R=ui->R, _U=ui->U, _B=ui->B;
- if(IsVertical){
- Seg = ui->R - ui->L;
- _U = ui->U + i * LA_RH; _B = _U+LA_RH;
- }else{
- Seg = (ui->R - ui->L) / Len;
- _L = ui->L + i * Seg; _R=_L+Seg;
- }
- buf[0] = '\0'; buf2[0] = '\0';
- if(Len==1){ strcat(buf2, transLate(ui->PP.LastPs->p->Name)); }
- if(i<8)strcat(Len==1?buf:buf2, &prefix[i]);
- strPrintFloatAfter(buf, 48, 3, IsRad?deg(Data[i]):Data[i]);
- strAppend(buf, ui->PP.LastPs->p->Unit ? transLate(ui->PP.LastPs->p->Unit) : "");
- if (ui->Extra && ui->Extra->On == i + 1){
- Original = ui->State;
- ui->State = LA_UI_ACTIVE;
- }
- if(IsKnob && !ui->Extra->Edit){
- real ctrx = (real)(_L+_R)/2.0f, ctry=(real)(_U+_B)/2.0f, radius=TNS_MIN2((_B-_U)/2.0f,(_R-_L)/2.0f);
- tnsUseNoTexture();
- real dgx=0,dgy=0;
- if(radius*2>(_B-_U)-LA_RH/5){ dgx = radius/1.5; }
- if(radius*2>(_R-_L)-LA_RH/5){ dgy = radius/1.5; }
- tnsColor4dv(laThemeColor(bt,LA_BT_BORDER));
- tnsVertex2d(_L, ctry-dgy); tnsVertex2d(_L, _U); tnsVertex2d(ctrx-dgx, _U); tnsPackAs(GL_LINE_STRIP);
- tnsVertex2d(_R, ctry-dgy); tnsVertex2d(_R, _U); tnsVertex2d(ctrx+dgx, _U); tnsPackAs(GL_LINE_STRIP);
- tnsVertex2d(_R, ctry+dgy); tnsVertex2d(_R, _B); tnsVertex2d(ctrx+dgx, _B); tnsPackAs(GL_LINE_STRIP);
- tnsVertex2d(_L, ctry+dgy); tnsVertex2d(_L, _B); tnsVertex2d(ctrx-dgx, _B); tnsPackAs(GL_LINE_STRIP);
-
- real verts[52];//24*2+ctr+overlap
- tnsMakeCircle2d(&verts[2],24,ctrx,ctry,radius,0);
- tnsVectorCopy2d(&verts[2],&verts[50]);
- verts[0]=ctrx; verts[1]=ctry;
- tnsColor4dv(laThemeColor(bt,ui->State));
- tnsVertexArray2d(verts,26); tnsPackAs(GL_TRIANGLE_FAN);
- tnsMakeCircle2d(verts,24,ctrx,ctry,radius,0);
- tnsColor4dv(laThemeColor(bt,LA_BT_BORDER));
- tnsVertexArray2d(verts,24); tnsPackAs(GL_LINE_LOOP);
- if(Ranged){
- real arc[52]; int arcindex[26]; // 12 slices 13 ends
- real range,rstart;
- if(min<0&&max>0){ rstart=TNS_PI*3.5; range = (real)(Data[i]) / (real)(max) * TNS_PI * 1.5 * max/(max-min);}
- else{ rstart=TNS_PI*2.75; range = (real)(Data[i] - min) / (real)(max - min) * TNS_PI * 1.5; }
- tnsMakeArc2d(arc,12,ctrx,ctry,radius,rstart, rstart + range);
- tnsMakeArc2d(&arc[26],12,ctrx,ctry,radius*0.6,rstart, rstart + range);
- tnsMakeBridgedIndex(arcindex, 13, 0, 0);
- real *color = laThemeColor(bt,LA_BT_TEXT|ui->State); //tnsColor4d(LA_COLOR3(color),0.3);
- tnsColor4dv(color);
- tnsVertexArray2d(arc,26); tnsIndexArray(arcindex,26); tnsPackAs(GL_TRIANGLE_STRIP);
- tnsMakeArc2d(&arc[2],12,ctrx,ctry,radius*0.6,TNS_PI*2.75, TNS_PI*4.25);
- arc[0] = ctrx + cos(TNS_PI*2.75) * radius; arc[1] = ctry + sin(TNS_PI*2.75) * radius;
- arc[28] =ctrx + cos(TNS_PI*4.25) * radius; arc[29] =ctry + sin(TNS_PI*4.25) * radius;
- tnsVertexArray2d(arc,15);
- tnsColor4dv(laThemeColor(bt,LA_BT_BORDER));
- tnsPackAs(GL_LINE_STRIP);
- }
- }else{
- if(!NoDecal){
- tnsUseNoTexture();
- tnsColor4dv(laThemeColor(bt,ui->State));
- tnsVertex2d(_L, _U); tnsVertex2d(_R, _U);
- tnsVertex2d(_R, _B); tnsVertex2d(_L, _B);
- tnsPackAs(GL_TRIANGLE_FAN);
- if (Ranged){
- int L1 = _L;
- int R1 = (real)(Data[i] - min) / (real)(max - min) * (real)(Seg) + L1;
- tnsUseNoTexture(); real* color=laThemeColor(bt,LA_BT_TEXT);
- tnsColor4d(LA_COLOR3(color),0.3);
- tnsVertex2d(L1, _U); tnsVertex2d(R1, _U);
- tnsVertex2d(R1, _B); tnsVertex2d(L1, _B);
- tnsPackAs(GL_TRIANGLE_FAN);
- }
- tnsColor4dv(laThemeColor(bt,LA_BT_BORDER));
- tnsVertex2d(_L, _U); tnsVertex2d(_R, _U);
- tnsVertex2d(_R, _B); tnsVertex2d(_L, _B);
- tnsPackAs(GL_LINE_LOOP);
- }
- if (ui->Extra->On == i + 1 && ui->Extra->Edit){
- uint32_t *buf = strGetCursorLine(ui->Extra->Edit,0)->Buf;
- int LL = _L + (Seg - tnsStringGetWidthU(buf, 0, ui->Flags&LA_TEXT_MONO)) / 2;
- tnsColor4dv(laThemeColor(bt, LA_BT_TEXT));
- la_SingleLineStringDrawSelection(ui, _L, _U, bt, buf, ui->Extra->Edit);
- tnsDrawStringM(0, buf, laThemeColor(bt, LA_BT_TEXT_ACTIVE), _L + bt->LM, _R - bt->RM, _U, ui->Flags);
- }else{
- tnsDrawStringWithPriority(NoLabel?0:buf2, buf,
- IsDisabled?laThemeColor(bt, LA_BT_DISABLED):laThemeColor(bt, LA_BT_TEXT|ui->State), bt->TextAlign, _L + bt->LM, _R - bt->RM, _U, ui->Flags);//, ui->ExtraInstructions);
- }
- }
- if (ui->Extra && ui->Extra->On == i + 1) ui->State = Original;
- }
- tnsFlush();
- }
- void la_FloatArrayColorDraw(laUiItem *ui, int h){
- laBoxedTheme *bt = (*ui->Type->Theme);
- real Data[32];
- int Len, i;
- int IsColorful=ui->Flags&LA_UI_FLAGS_COLORFUL;
- laGetFloatArray(&ui->PP, Data);
- Len = laGetArrayLength(&ui->PP);
- if(ui->PP.LastPs->p->Tag&LA_PROP_IS_LINEAR_SRGB){ tns2LogsRGB(Data); }
- tnsUseNoTexture();
- if(IsColorful){
- int sw=(ui->R-ui->L)/2;
- tnsColor4d(Data[0], Data[1], Data[2], 1);
- tnsVertex2d(ui->L, ui->U); tnsVertex2d(ui->L+sw, ui->U);
- tnsVertex2d(ui->L+sw, ui->B); tnsVertex2d(ui->L, ui->B);
- tnsPackAs(GL_TRIANGLE_FAN);
- tnsColor4d(Data[0], Data[1], Data[2], Len>3?Data[3]:1);
- tnsVertex2d(ui->L+sw, ui->U); tnsVertex2d(ui->R, ui->U);
- tnsVertex2d(ui->R, ui->B); tnsVertex2d(ui->L+sw, ui->B);
- tnsUseHalftone(1.0); tnsPackAs(GL_TRIANGLE_FAN); tnsUseHalftone(0.0);
- }else{
- tnsColor4d(Data[0], Data[1], Data[2], 1);
- tnsVertex2d(ui->L, ui->U); tnsVertex2d(ui->R, ui->U);
- tnsVertex2d(ui->R, ui->B); tnsVertex2d(ui->L, ui->B);
- tnsPackAs(GL_TRIANGLE_FAN);
- }
- int NoDecal=ui->Flags&LA_UI_FLAGS_NO_DECAL;
- if(!NoDecal){
- tnsColor4dv(laThemeColor(bt,LA_BT_BORDER));
- tnsVertex2d(ui->L, ui->U); tnsVertex2d(ui->R, ui->U);
- tnsVertex2d(ui->R, ui->B); tnsVertex2d(ui->L, ui->B);
- tnsPackAs(GL_LINE_LOOP);
- }
- tnsFlush();
- }
- void la_EnumSelectorDraw(laUiItem *ui, int h){
- laEnumItem *Data[32], Len;
- laBoxedTheme *bt = (*ui->Type->Theme);
- char buf[48] = {0};
- char buf2[48] = {0};
- char prefix[8][64]= {0};
- laEnumProp *ep = ui->PP.LastPs->p;
- int HasIcon = laEnumHasIcon(&ui->PP);
- int NoDecal=ui->Flags&LA_UI_FLAGS_NO_DECAL;
- int IconOnly=ui->Flags&LA_UI_FLAGS_ICON;
- int NoEvent=ui->Flags&LA_UI_FLAGS_NO_EVENT;
- int Highlight=ui->Flags&LA_UI_FLAGS_HIGHLIGHT;
- int IsDisabled=ui->Flags&LA_UI_FLAGS_DISABLED;
- // norm e1
- // expand e1 e2 e3
- // expand vertical (vertical)
- // arr expand e1 e1 e3
- // e2 e2 e3
- // arr exp+vert e1 e1
- // e2 e2
- // e3 e3
- tnsUseNoTexture();
- laGetEnumArray(&ui->PP,Data);
- laEnumItem* ei, *use_ei;
- int IsVertical = ui->Flags&LA_UI_FLAGS_TRANSPOSE;
- int IsExpand = ui->Flags&LA_UI_FLAGS_EXPAND;
- int IsCycle = ui->Flags&LA_UI_FLAGS_CYCLE;
- int ArrLen = laGetArrayLength(&ui->PP);
- if(ArrLen==1){ if(!IsExpand) IsVertical=0; }else{ IsExpand=1; }
- int EnumLen = (IsExpand&&(!IsCycle)) ? laGetEnumEntryLen(&ui->PP) : 1;
- if(Highlight&&ArrLen!=1){laGetPrefixP(&ui->PP, prefix);}
- if (laIsPropertyReadOnly(&ui->PP) && !NoDecal) ui->State = LA_BT_DISABLED;
- int _L,_R,_U,_B, _W=ui->R - ui->L;
- if(IsVertical){
- if(IsExpand){ _W/=ArrLen; }
- }else{
- if(IsExpand){ _W/=EnumLen; }
- else{ _W/=ArrLen; }
- }
-
- int UseIco=0,ico=0; char buft[48]={0}; int HasText=0;
- if (ui->ExtraInstructions){
- if (ui->Type->OperatorType->ParseArgs){
- ui->Type->OperatorType->ParseArgs(ui->Instructions, &UseIco, buft);
- }
- sprintf(buf,"%s",transLate(buft)); HasText=1;
- }
- for(int i=0;i<ArrLen;i++){
- if(!Data[i]){ Data[i]=((laEnumProp*)ui->PP.LastPs->p)->Items.pFirst; }
- _L=ui->L; _R=ui->R; _U=ui->U; _B=ui->B; ei = ep->Items.pFirst;
- for(int j=0;j<EnumLen;j++){ if(!HasText)buf[0]=0;
- ico=UseIco;
- if(IsVertical){
- if(IsExpand){ _U=ui->U+j*LA_RH; _L=ui->L+i*_W; }
- else{ _U=ui->U+i*LA_RH; _L=ui->L; }
- }else{
- if(IsExpand){ _U=ui->U+i*LA_RH; _L=ui->L+j*_W; }
- else{ _U=ui->U; _L=ui->L+i*_W; }
- }
- _B=_U+LA_RH; _R=_L+_W;
- int ExtraState=IsDisabled?LA_BT_DISABLED:ui->State;
- if(IsExpand&&!IsCycle){ use_ei = ei; ei=ei->Item.pNext; ExtraState=(use_ei==Data[i])?LA_BT_ACTIVE:ExtraState; }
- else{ use_ei = Data[i]; if(Highlight && Data[i]->Index!=0){ ExtraState=LA_BT_ACTIVE; } }
- if(!NoDecal){
- tnsUseNoTexture();
- tnsColor4dv(laThemeColor(bt, ExtraState));
- tnsVertex2d(_L, _U); tnsVertex2d(_R, _U);
- tnsVertex2d(_R, _B); tnsVertex2d(_L, _B);
- tnsPackAs(GL_TRIANGLE_FAN);
- tnsColor4dv(laThemeColor(bt, LA_BT_BORDER));
- tnsVertex2d(_L, _U); tnsVertex2d(_R, _U);
- tnsVertex2d(_R, _B); tnsVertex2d(_L, _B);
- tnsPackAs(GL_LINE_LOOP);
- }
- if(Highlight){ if(!HasText && ArrLen==1) strcpy(buf, transLate(ui->PP.LastPs->p->Name)); else{ if(i<8)strcat(buf, &prefix[i]); } }
- if((!HasText) && (!buf[0])) strcpy(buf, transLate(use_ei->Name));
- int iconR; if(IconOnly)iconR=TNS_MAX2(_L+LA_RH,_R);else{ iconR=TNS_MIN2(_L+LA_RH,_R); }
- if (use_ei->IconID && !ico){ ico=use_ei->IconID; }
- if (ico) tnsDrawIcon(ico, laThemeColor(bt, LA_BT_TEXT|ExtraState), _L,iconR, _U, LA_TEXT_ALIGN_CENTER);
- if(!IconOnly){
- int UseFlags=ui->Flags; if(!HasIcon && IsExpand){ if(!(UseFlags&LA_TEXT_ALIGN)); UseFlags|=LA_TEXT_ALIGN_CENTER; }
- tnsDrawStringAuto(buf, laThemeColor(bt, LA_BT_TEXT|ExtraState), _L+bt->LM+(HasIcon?LA_RH:0), _R-bt->RM, _U, UseFlags);
- }
- if (!IsExpand && !IsVertical && !IconOnly && !IsCycle && !NoEvent){
- tnsDrawIcon(U'🔻', laThemeColor(bt, LA_BT_TEXT|ExtraState), _R-LA_RH, _R, _U, ui->Flags);
- }
- }
- }
- tnsFlush();
- }
- void la_ButtonDraw(laUiItem *ui, int h){
- laBoxedTheme *bt = (*ui->Type->Theme);
- char buf[LA_RAW_CSTR_MAX_LEN] = {0};
- char *label = 0;
- uint32_t IconID=0;
- int L;
- char *Identifier;
- laOperatorProp *ap = 0;
- int NoDecal=ui->Flags&LA_UI_FLAGS_NO_DECAL;
- int IconOnly=ui->Flags&LA_UI_FLAGS_ICON;
- int IsHighlight=ui->Flags&LA_UI_FLAGS_HIGHLIGHT;
- int IsWarning=ui->Flags&LA_UI_FLAGS_WARNING;
- if (ui->PP.LastPs && ui->PP.LastPs->p){
- ap = ui->PP.LastPs->p;
- label = transLate(ap->Base.Name);
- if (!ap->OperatorType) ap->OperatorType = laGetOperatorType(ap->OperatorID);
- IconID = ap->Base.IconID ? ap->Base.IconID : ap->OperatorType->IconID;
- }else{
- label = transLate(ui->AT->Name);
- IconID = ui->AT->IconID;
- }
- if (ui->AT && (!laOperatorAvailableP(ui->AT, 0, ui->Instructions)))
- ui->State = LA_UI_DISABLED;
- elif (ap && ap->OperatorType && (!laOperatorAvailablePSafe(ap->OperatorType, ui->PP.RawThis, ui->PP.Go->UseInstance, ui->Instructions))) ui->State = LA_UI_DISABLED;
- else if (ui->State == LA_UI_DISABLED) ui->State = LA_UI_NORMAL;
- if(!NoDecal){
- tnsUseNoTexture();
- tnsColor4dv(ui->State==LA_UI_NORMAL?(
- IsHighlight?laAccentColor(LA_BT_NORMAL):(IsWarning?laAccentColor(LA_BT_WARNING):laThemeColor(bt, ui->State)))
- :laThemeColor(bt, ui->State));
- tnsVertex2d(ui->L, ui->U); tnsVertex2d(ui->R, ui->U);
- tnsVertex2d(ui->R, ui->B); tnsVertex2d(ui->L, ui->B);
- tnsPackAs(GL_TRIANGLE_FAN);
- tnsColor4dv(laThemeColor(bt, LA_BT_BORDER));
- tnsVertex2d(ui->L, ui->U); tnsVertex2d(ui->R, ui->U);
- tnsVertex2d(ui->R, ui->B); tnsVertex2d(ui->L, ui->B);
- tnsPackAs(GL_LINE_LOOP);
- }
- if (ui->ExtraInstructions){
- uint32_t tIconID=0;
- if (ui->AT && ui->AT->ParseArgs){
- ui->AT->ParseArgs(ui->Instructions, &tIconID, buf);
- if (buf[0]) label = transLate(buf);
- if (tIconID) IconID=tIconID;
- }else if (ui->PP.LastPs->p->PropertyType == LA_PROP_OPERATOR){
- laOperatorProp *ap = ui->PP.LastPs->p;
- if (ap->OperatorType && ap->OperatorType->ParseArgs){
- ap->OperatorType->ParseArgs(ui->Instructions, &tIconID, buf);
- if (buf[0]) label = transLate(buf);
- if (tIconID) IconID=tIconID;
- }
- }
- }
- if (IconID) L = ui->L + bt->LM + h;
- else L = ui->L + bt->LM;
- if (IconID) tnsDrawIcon(IconID, laThemeColor(bt, ui->State|LA_BT_TEXT), ui->L, IconOnly?(ui->R):(ui->L+LA_RH), ui->U, LA_TEXT_ALIGN_CENTER);
- if (!IconOnly) tnsDrawStringAuto(label, laThemeColor(bt, ui->State|LA_BT_TEXT), L, ui->R-bt->RM, ui->U, ui->Flags);
- }
- void la_LabelDraw(laUiItem *ui, int h){
- laBoxedTheme *bt = (*ui->Type->Theme);
- int IsDisabled=ui->Flags&LA_UI_FLAGS_DISABLED;
- int IsHighlight=ui->Flags&LA_UI_FLAGS_HIGHLIGHT;
- int IsWarning=ui->Flags&LA_UI_FLAGS_WARNING;
- if (!ui->State) ui->State = LA_UI_NORMAL;
- if (ui->ExtraInstructions && !ui->Instructions){
- strMakeInstructions(&ui->Instructions, ui->ExtraInstructions->Ptr);
- }
- //int State = ui->Instructions ? (strArgumentMatch(ui->Instructions, "disabled", "true") ? LA_THEME_DISABLED : LA_UI_NORMAL) : LA_UI_NORMAL;
- tnsDrawStringAuto(transLate(SSTR(ui->Display)),
- IsDisabled?laThemeColor(bt,LA_BT_TEXT|LA_UI_DISABLED):
- (IsHighlight?laAccentColor(LA_BT_TEXT):
- (IsWarning?laAccentColor(LA_BT_WARNING):laThemeColor(bt,LA_BT_TEXT))),
- ui->L, ui->R, ui->U, ui->Flags);
- }
- void la_SingleLineStringDrawSelection(laUiItem *ui, int Begin, int U, laBoxedTheme *bt, uint32_t *str, laStringEdit *se){
- tnsUseNoTexture();
- if (!strHasSelection(se)){
- tnsColor4dv(laAccentColor(LA_BT_TEXT));
- int L = (se->CursorBefore ? tnsStringGetWidthU(str, se->CursorBefore, ui->Flags&LA_TEXT_MONO) : 0) + Begin + bt->LM;
- tnsVertex2d(L-1, U + LA_RH - bt->BM);
- tnsVertex2d(L-1, U + bt->TM);
- tnsVertex2d(L+2, U + bt->TM);
- tnsVertex2d(L+2, U + LA_RH - bt->BM);
- tnsPackAs(GL_TRIANGLE_FAN);
- }else{
- int L = (se->BeginBefore ? tnsStringGetWidthU(str, se->BeginBefore, ui->Flags&LA_TEXT_MONO) : 0) + Begin + bt->LM;
- int R = (se->EndBefore ? tnsStringGetWidthU(str, se->EndBefore, ui->Flags&LA_TEXT_MONO) : 0) + Begin + bt->LM;
- tnsColor4dv(laAccentColor(LA_BT_NORMAL));
- tnsVertex2d(L, U + bt->TM);
- tnsVertex2d(L, U + LA_RH - bt->BM);
- tnsVertex2d(R, U + LA_RH - bt->TM);
- tnsVertex2d(R, U + bt->BM);
- tnsPackAs(GL_TRIANGLE_FAN);
- }
- }
- void la_SingleLineStringDraw(laUiItem *ui, int h){
- laBoxedTheme *bt = (*ui->Type->Theme);
- char* _temp[LA_RAW_CSTR_MAX_LEN] = {0}; char* temp=_temp;
- uint32_t* line=0;
- int NoDecal=ui->Flags&LA_UI_FLAGS_NO_DECAL;
- int IsDisabled=ui->Flags&LA_UI_FLAGS_DISABLED;
- if (!ui->State) ui->State = LA_UI_NORMAL;
- if(!NoDecal){
- tnsUseNoTexture();
- tnsColor4dv(laThemeColor(bt, ui->State));
- tnsVertex2d(ui->L, ui->U); tnsVertex2d(ui->R, ui->U);
- tnsVertex2d(ui->R, ui->B); tnsVertex2d(ui->L, ui->B);
- tnsPackAs(GL_TRIANGLE_FAN);
- tnsColor4dv(laThemeColor(bt, LA_BT_BORDER));
- tnsVertex2d(ui->L, ui->U); tnsVertex2d(ui->R, ui->U);
- tnsVertex2d(ui->R, ui->B); tnsVertex2d(ui->L, ui->B);
- tnsPackAs(GL_LINE_LOOP);
- }
- if (ui->Extra && ui->Extra->Edit){
- line=strGetCursorLine(ui->Extra->Edit,0)->Buf;
- }else{
- laGetString(&ui->PP, _temp, &temp);
- }
- if (line) la_SingleLineStringDrawSelection(ui, ui->L+(NoDecal?0:bt->LM), ui->U, bt, line, ui->Extra->Edit);
- if(ui->PP.LastPs->p->CanTranslate){ temp=transLate(temp); }
- tnsDrawStringAutoM(line?0:temp, line, IsDisabled?laThemeColor(bt,LA_BT_TEXT|LA_UI_DISABLED):laThemeColor(bt,LA_BT_TEXT), ui->L+(NoDecal?0:bt->LM), ui->R-(NoDecal?0:bt->RM), ui->U, ui->Flags);
- }
- void la_MultiStringDraw(laUiItem *ui, int h){
- laBoxedTheme *bt = (*ui->Type->Theme);
- char _temp[LA_RAW_CSTR_MAX_LEN] = {0}; char* temp=_temp;
- int NoDecal=ui->Flags&LA_UI_FLAGS_NO_DECAL;
- if (!ui->State) ui->State = LA_UI_NORMAL;
- int NumberWidth=bt->LM;
- if((!ui->Extra->Edit) || (ui->Extra->Ptr1!=ui->PP.EndInstance)){
- laGetString(&ui->PP, _temp, &temp);
- strBeginEdit(&ui->Extra->Edit, temp);
- ui->Extra->Ptr1=ui->PP.EndInstance;
- }
- laStringEdit* se=ui->Extra->Edit;
- real MonoWidth=tnsGetMonoFontAdvance(); int Count=se->TotalLines;
- while(Count){ Count/=10; NumberWidth+=MonoWidth; }
- if (ui->State!=LA_UI_ACTIVE){
- strSetEditViewRange(ui->Extra->Edit,
- ui->Extra->HeightCoeff>0?ui->Extra->HeightCoeff:((ui->B-ui->U)/LA_RH),(ui->R-ui->L-NumberWidth-bt->LM*2-bt->RM)/MonoWidth);
- }
- if(!NoDecal){
- tnsUseNoTexture();
- tnsColor4dv(laThemeColor(bt, ui->State));
- tnsVertex2d(ui->L, ui->U); tnsVertex2d(ui->R, ui->U);
- tnsVertex2d(ui->R, ui->B); tnsVertex2d(ui->L, ui->B);
- tnsPackAs(GL_TRIANGLE_FAN);
- tnsColor4dv(laThemeColor(bt, LA_BT_BORDER));
- tnsVertex2d(ui->L, ui->U); tnsVertex2d(ui->R, ui->U);
- tnsVertex2d(ui->R, ui->B); tnsVertex2d(ui->L, ui->B);
- tnsPackAs(GL_LINE_LOOP);
- tnsColor4d(LA_COLOR3(laThemeColor(bt,LA_BT_BORDER)),0.8);
- tnsVertex2d(ui->L, ui->U); tnsVertex2d(ui->L+NumberWidth, ui->U);
- tnsVertex2d(ui->L, ui->B); tnsVertex2d(ui->L+NumberWidth, ui->B);
- tnsPackAs(GL_QUADS);
- if(!(se->CursorLine<se->ViewStartLine||se->CursorLine>se->ViewStartLine+se->ViewHeight)){
- int LineU=(se->CursorLine-se->ViewStartLine)*LA_RH+ui->U;
- tnsColor4dv(ui->State==LA_UI_ACTIVE?laAccentColor(LA_BT_NORMAL):laThemeColor(bt,LA_BT_BORDER));
- tnsVertex2d(ui->L, LineU); tnsVertex2d(ui->R, LineU);
- tnsVertex2d(ui->L, LineU+LA_RH); tnsVertex2d(ui->R, LineU+LA_RH);
- tnsPackAs(GL_LINES);
- tnsColor4dv(ui->State==LA_UI_ACTIVE?laAccentColor(LA_BT_TEXT):laThemeColor(bt,LA_BT_TEXT_NORMAL));
- tnsVertex2d(ui->L, LineU); tnsVertex2d(ui->L+NumberWidth, LineU);
- tnsVertex2d(ui->L, LineU+LA_RH); tnsVertex2d(ui->L+NumberWidth, LineU+LA_RH);
- tnsPackAs(GL_QUADS);
- }
- }else{
- NumberWidth=bt->LM;
- }
- tnsColor4dv(laThemeColor(bt, LA_BT_TEXT));
- int Line=0, Skip=0, _L=ui->L+NumberWidth+bt->LM; char num[10]={0};
- for(laStringLine* sl=se->Lines.pFirst;sl;sl=sl->Item.pNext){
- int UseLine=Line+Skip;
- if(UseLine<se->ViewStartLine){ Skip++; continue; }
- if(UseLine>=se->ViewHeight+se->ViewStartLine){ break; }
- int slen=strlenU(sl->Buf);
- sprintf(num,"%d", UseLine+1); int LineU=ui->U+Line*LA_RH;
- tnsDrawStringM(num, 0, laThemeColor(bt, ((UseLine==se->CursorLine)?LA_BT_NORMAL:LA_BT_TEXT)),
- _L-bt->LM -(tnsStringGetWidth(num, 0, ui->Flags&LA_TEXT_MONO)), ui->R, LineU, ui->Flags);
- if(slen>=se->ViewStartCol){
- tnsDrawStringM(0, &sl->Buf[se->ViewStartCol], laThemeColor(bt, ui->State|LA_BT_TEXT), _L, ui->R, LineU, ui->Flags|LA_TEXT_OVERFLOW_ARROW);
- }
- if(UseLine>=se->BeginLine&&UseLine<=se->EndLine){
- int BeginC=UseLine==se->BeginLine?se->BeginBefore:0; int EndC=UseLine==se->EndLine?se->EndBefore:slen;
- BeginC-=se->ViewStartCol; EndC-=se->ViewStartCol; if(EndC>se->ViewWidth)EndC=se->ViewWidth;
- tnsUseNoTexture();
- tnsVertex2d(BeginC*MonoWidth+_L, LineU); tnsVertex2d(EndC*MonoWidth+_L, LineU);
- tnsVertex2d(EndC*MonoWidth+_L, LineU+LA_RH); tnsVertex2d(BeginC*MonoWidth+_L, LineU+LA_RH);
- tnsColor4dv(laAccentColor(LA_BT_NORMAL));
- tnsPackAs(GL_TRIANGLE_FAN);
- }
- int len=strlenU(sl->Buf);
- if(UseLine==se->CursorLine){
- int Dist=se->CursorBefore==0?0:tnsStringGetWidthU(sl->Buf,se->CursorBefore,ui->Flags&LA_TEXT_MONO);
- tnsUseNoTexture(); int d=se->ViewStartCol*MonoWidth; real w2=LA_RH/12;
- tnsColor4dv(ui->State==LA_UI_ACTIVE?laAccentColor(LA_BT_TEXT):laThemeColor(bt,LA_BT_TEXT_NORMAL));
- tnsVertex2d(_L+Dist-w2-d, LineU); tnsVertex2d(_L+Dist+w2-d, LineU);
- tnsVertex2d(_L+Dist-w2-d, LineU+LA_RH); tnsVertex2d(_L+Dist+w2-d, LineU+LA_RH);
- tnsPackAs(GL_QUADS);
- }
- Line++;
- tnsFlush();
- }
- if(ui->Extra->HeightCoeff>=0)
- tnsDrawStringAuto("◿",laThemeColor(bt,LA_BT_BORDER),ui->R-LA_RH, ui->R, ui->B-bt->BM-LA_RH, LA_TEXT_ALIGN_CENTER);
- if(!NoDecal){
- char buf[100]={0}; sprintf(buf, "%d,%d | %d Lines", se->CursorLine+1, se->CursorBefore+1, se->TotalLines);
- tnsDrawStringAuto(buf,laThemeColor(bt,LA_BT_BORDER),ui->L, ui->R-LA_RH, ui->B-bt->BM-LA_RH, LA_TEXT_MONO|LA_TEXT_ALIGN_RIGHT);
- }
-
- //if (ui->Extra && ui->Extra->Edit) la_SingleLineStringDrawSelection(ui, ui->L, ui->U, bt, temp, ui->Extra->Edit);
- tnsFlush();
- }
- void la_UiSeperatorDraw(laUiItem *ui, int h){
- laBoxedTheme *bt = (*ui->Type->Theme);
- if (!bt) return;
- if(ui->Flags&LA_UI_FLAGS_TRANSPOSE){
- char str[]="🞄";
- int strw=tnsStringGetWidth(str,0, 0);
- tnsDrawStringM(str, 0, laThemeColor(bt,LA_BT_BORDER), ui->L+(ui->R-ui->L-strw)/2, ui->R, ui->U, 0);
- }else{
- tnsUseNoTexture();
- tnsColor4dv(laThemeColor(bt,LA_BT_BORDER));
- real u=(ui->U+ui->B)/2; tnsVertex2d(ui->L, u); tnsVertex2d(ui->R, (ui->U+ui->B)/2);
- tnsPackAs(GL_LINES);
- }
- }
- void la_ColorCircleDrawHCY(laUiItem *ui, int h){
- laBoxedTheme *bt = (*ui->Type->Theme);
- real c = (real)((ui->R + ui->L) / 2) - h / 2; /*- bt->RM*/
- real r = (ui->B - ui->U - bt->TP - bt->BP) / 2;
- int i = 0;
- real colors[584]={0}; //4*72*2+4*2
- real verts[292]={0}; //72*2*2+2*2
- real hcy[3] = {0, 1, 1};
- real step = 1.0 / 72.0f;
- real RealColor[4] = {0,0,0,1};
- real PickerPos[2];
- real pi_4;
- GLuint index[26];
- real v, cv, sv;
- real lw = (float)(ui->B-ui->U)/LA_RH/5; if(lw<1.0f) lw=1.0f;
- laGetFloatArray(&ui->PP, RealColor);
- if(ui->PP.LastPs->p->Tag&LA_PROP_IS_LINEAR_SRGB){ tns2LogsRGB(RealColor); }
- tnsRGB2HCY(RealColor, hcy);
- PickerPos[0] = c + cos(hcy[0] * TNS_PI * 2) * pow(hcy[1],1.0f/MAIN.ColorPickerGamma) * r;
- PickerPos[1] = ui->U + r + sin(hcy[0] * TNS_PI * 2) * pow(hcy[1],1.0f/MAIN.ColorPickerGamma) * r;
- hcy[0] = 0;
- hcy[1] = 1;
- for (i; i < 72; i += 1){
- int beg = i * 8;
- hcy[0]+=step; tnsVectorSet3v(&colors[beg],hcy); colors[beg+3]=1;
- tnsVectorSet4v(&colors[beg+4],&colors[beg]); colors[beg+5]=0;
- }
- tnsFlush();
- int IsClay=ui->Flags&LA_UI_FLAGS_COLOR_SPACE_CLAY;
- int ShowInfo=0;
- if(MAIN.CurrentWindow->OutputColorSpace!=TNS_COLOR_SPACE_SRGB && (!IsClay)){
- tnsUniformShowColorOverflowStripes(T->immShader,1);
- }
- if(IsClay){
- tnsUniformInputColorSpace(T->immShader,TNS_COLOR_SPACE_CLAY);
- if(MAIN.CurrentWindow->OutputColorSpace!=TNS_COLOR_SPACE_CLAY) ShowInfo=1;
- }else{
- tnsUniformInputColorSpace(T->immShader,TNS_COLOR_SPACE_SRGB);
- }
- tnsUseNoTexture();
- tnsVectorSet4(&colors[576],1,1,hcy[2],1);
- tnsVectorSet4(&colors[580],1,0,hcy[2],1);
- tnsColorArray4d(colors, 146);
- tnsMakeCircle2d(verts, 72, c, ui->U + r, r, 1);
- for(int i=0;i<73;i++){ tnsVectorSet2(&verts[2+i*4],c,ui->U + r); }
- tnsVectorSet2v(&verts[288],&verts[0]);
- tnsVectorSet2v(&verts[290],&verts[2]);
- tnsVertexArray2d(verts, 146);
- tnsPackAs(GL_TRIANGLE_STRIP);
- tnsUniformColorMode(T->immShader,1); tnsUniformHCYGamma(T->immShader,MAIN.ColorPickerGamma);
- tnsFlush();
- tnsUniformColorMode(T->immShader,0);
- tnsColor4dv(laThemeColor(bt,LA_BT_BORDER));
- tnsMakeCircle2d(verts, 72, c, ui->U + r, r, 0);
- tnsVertexArray2d(verts, 72);
- tnsPackAs(GL_LINE_LOOP);
- pi_4 = TNS_PI / 4;
- tnsMakeArc2d(&verts[26], 12, c, ui->U + r, r + bt->LM + h, pi_4, -pi_4);
- tnsMakeArc2d(verts, 12, c, ui->U + r, r + bt->LM, pi_4, -pi_4);
- tnsMakeLinerGradient4d(&colors[52], 13, 0, 0, 0, 1, 1, 1, 1, 1);
- tnsMakeLinerGradient4d(colors, 13, 0, 0, 0, 1, 1, 1, 1, 1);
- tnsMakeBridgedIndex(index, 13, 0, 0);
- tnsColorArray4d(colors, 26);
- tnsVertexArray2d(verts, 26);
- tnsIndexArray(index, 26);
- tnsPackAs(GL_QUAD_STRIP);
- tnsMakeArc2d(&verts[26], 12, c, ui->U + r, r + bt->LM + h, -pi_4, pi_4);
- tnsColor4dv(laThemeColor(bt,LA_BT_BORDER));
- tnsVertexArray2d(verts, 26);
- tnsPackAs(GL_LINE_LOOP);
- v = -hcy[2] + 0.5;
- cv = cos(v / 2 * TNS_PI);
- sv = sin(v / 2 * TNS_PI);
- tnsLineWidth(lw);
- verts[0] = cv * r + c; verts[1] = sv * r + ui->U + r;
- verts[2] = cv * (r + h) + c; verts[3] = sv * (r + h) + ui->U + r;
- tnsColor4d(1, 1, 1, 1);
- tnsVertexArray2d(verts, 2);
- tnsPackAs(GL_LINES);
- verts[1]+=lw; verts[3]+=lw;
- tnsColor4d(0, 0, 0, 1);
- tnsVertexArray2d(verts, 2);
- tnsPackAs(GL_LINES);
- real circleR=lw*8;
- tnsColor4dv(RealColor);
- tnsMakeCircle2d(verts, 16, PickerPos[0], PickerPos[1], circleR,0);
- tnsVertexArray2d(verts, 16);
- tnsPackAs(GL_TRIANGLE_FAN);
- tnsColor4d(1, 1, 1, 1);
- tnsVertexArray2d(verts, 16);
- tnsPackAs(GL_LINE_LOOP);
- tnsMakeCircle2d(verts, 16, PickerPos[0], PickerPos[1], circleR-lw,0);
- tnsColor4d(0.1, 0.1, 0.1, 1);
- tnsVertexArray2d(verts, 16);
- tnsPackAs(GL_LINE_LOOP);
- tnsLineWidth(1);
- if(ui->Extra->HeightCoeff>=0) tnsDrawStringAuto("◿",laThemeColor(bt,LA_BT_BORDER),ui->R-LA_RH, ui->R, ui->B-bt->BM-LA_RH, LA_TEXT_ALIGN_CENTER);
- if(IsClay) tnsDrawStringAuto("Clay",laThemeColor(bt,LA_BT_BORDER),ui->L, c-r+LA_RH, ui->U+bt->TM, LA_TEXT_ALIGN_RIGHT|LA_TEXT_MONO);
- if(ShowInfo) tnsDrawStringAuto("🛈",laThemeColor(bt,LA_BT_TEXT),c-r, ui->R, ui->B-bt->BM-LA_RH, LA_TEXT_ALIGN_LEFT);
- tnsFlush();
- tnsUniformShowColorOverflowStripes(T->immShader,0);
- tnsUniformInputColorSpace(T->immShader,0);
- }
- void la_MenuItemDraw(laUiItem *ui, int h){
- laBoxedTheme *bt = (*ui->Type->Theme);
- int NoDecal=ui->Flags&LA_UI_FLAGS_NO_DECAL;
- if(!NoDecal){
- tnsUseNoTexture();
- tnsColor4dv(laThemeColor(bt, ui->State));
- tnsVertex2d(ui->L, ui->U); tnsVertex2d(ui->R, ui->U);
- tnsVertex2d(ui->R, ui->B); tnsVertex2d(ui->L, ui->B);
- tnsPackAs(GL_TRIANGLE_FAN);
- tnsColor4dv(laThemeColor(bt, LA_BT_BORDER));
- tnsVertex2d(ui->L, ui->U); tnsVertex2d(ui->R, ui->U);
- tnsVertex2d(ui->R, ui->B); tnsVertex2d(ui->L, ui->B);
- tnsPackAs(GL_LINE_LOOP);
- }
- tnsDrawStringAuto(transLate(ui->Display->Ptr), laThemeColor(bt, LA_BT_TEXT|ui->State), ui->L+bt->LM, ui->R, ui->U, ui->Flags);
- }
- void la_ConditionToggleDraw(laUiItem *ui, int h){
- laBoxedTheme *bt = (*ui->Type->Theme);
- char temp[128] = {0};
- char *buf[LA_RAW_CSTR_MAX_LEN];
- uint32_t IconID;
- int NoDecal=ui->Flags&LA_UI_FLAGS_NO_DECAL;
- if (!ui->State) ui->State = LA_UI_NORMAL;
- int UseState=ui->State;
- if (!(ui->Flags&LA_TEXT_ALIGN)) ui->Flags|=LA_TEXT_ALIGN_CENTER;
- if(!NoDecal){
- tnsUseNoTexture();
- tnsColor4dv(laThemeColor(bt, ui->State));
- tnsVertex2d(ui->L, ui->U);
- tnsVertex2d(ui->R, ui->U);
- tnsVertex2d(ui->R, ui->B);
- tnsVertex2d(ui->L, ui->B);
- tnsPackAs(GL_TRIANGLE_FAN);
- tnsColor4dv(laThemeColor(bt, LA_BT_BORDER));
- tnsVertex2d(ui->L, ui->U);
- tnsVertex2d(ui->R, ui->U);
- tnsVertex2d(ui->R, ui->B);
- tnsVertex2d(ui->L, ui->B);
- tnsPackAs(GL_LINE_LOOP);
- }else{
- UseState=LA_UI_NORMAL;
- }
- buf[0] = 0;
- if (ui->ExtraInstructions){
- if (ui->Type->OperatorType->ParseArgs){
- ui->Type->OperatorType->ParseArgs(ui->Instructions, &IconID, buf);
- }
- }
- if (buf[0]) tnsDrawStringAuto(transLate(buf), laThemeColor(bt, LA_BT_TEXT|UseState), ui->L+bt->LM, ui->R-bt->RM, ui->U, ui->Flags);
- else
- tnsDrawStringAuto(ui->State == LA_UI_ACTIVE ? "⯆" : "⯈", laThemeColor(bt, LA_BT_TEXT|UseState), ui->L+bt->LM, ui->R-bt->RM, ui->U, ui->Flags);
- }
- void la_DrawColumnAdjusterRecursive(int U, int B, laColumn *c, int W, tnsVector3d color, int LeftMost){
- if (c->LS){
- la_DrawColumnAdjusterRecursive(U, B, c->LS, W, color, LeftMost);
- la_DrawColumnAdjusterRecursive(U, B, c->RS, W, color, LeftMost);
- }else{
- if(c->IL==LeftMost) return;
- tnsDrawStringAuto("⌉⌈", color, c->IL-LA_RH, c->IL+LA_RH, U, LA_TEXT_ALIGN_CENTER);
- }
- }
- void la_ColumnAdjusterDraw(laUiItem *ui, int h){
- laBoxedTheme *bt = (*ui->Type->Theme);
- tnsUseNoTexture();
- tnsColor4dv(laThemeColor(bt,LA_BT_TEXT));
- la_DrawColumnAdjusterRecursive(ui->U, ui->U + LA_RH, ui->C, (bt->LM+bt->RM)/2, laThemeColor(bt, LA_BT_TEXT), ui->C->IL);
- }
- void la_ColumnViewerDraw(laUiItem *ui, int h){
- laBoxedTheme *bt = (*ui->Type->Theme);
- laColumn *c = ui->PP.EndInstance;
- int W = ui->R - ui->L - bt->LM - bt->RM;
- //if (c->IR == c->IL)
- // return;
- int T = c->Top->IR - c->Top->IL;
- int L = (int)((real)(c->IL - c->Top->IL) * W / T) + ui->L + bt->LM,
- R = (int)((real)(c->IR - c->Top->IL) * W / T) + ui->L + bt->LM;
- tnsUseNoTexture();
- tnsColor4dv(laThemeColor(bt,LA_BT_BORDER));
- tnsVertex2d(L, ui->U + bt->TM);
- tnsVertex2d(R, ui->U + bt->TM);
- tnsVertex2d(R, ui->B - bt->BM);
- tnsVertex2d(L, ui->B - bt->BM);
- tnsPackAs(GL_TRIANGLE_FAN);
- }
- void la_NodeSocketDraw(laUiItem *ui, int h){
- laBoxedTheme *bt = (*ui->Type->Theme);
- char* label=0; char* icon;
- laProp* p=ui->PP.LastPs->p; laPropContainer* pc=la_EnsureSubTarget(p,0);
- real* ColorBkg=0,*ColorSocket;
- if(pc==LA_PC_SOCKET_IN) { laNodeInSocket*s=ui->PP.EndInstance; ColorSocket=laThemeColor(bt,LA_BT_TEXT); ColorBkg=laThemeColor(bt, LA_BT_NORMAL); label=s->Label?s->Label->Ptr:""; }
- elif(pc==LA_PC_SOCKET_OUT){ laNodeOutSocket*s=ui->PP.EndInstance; ColorSocket=laThemeColor(bt,LA_BT_TEXT_ACTIVE); ColorBkg=laThemeColor(bt, LA_BT_ACTIVE); label=s->Label?s->Label->Ptr:""; }
- int IsDisabled=ui->Flags&LA_UI_FLAGS_DISABLED;
- tnsUseNoTexture();
- tnsVertex2d(ui->L, ui->U); tnsVertex2d(ui->R, ui->U);
- tnsVertex2d(ui->R, ui->B); tnsVertex2d(ui->L, ui->B);
- tnsColor4dv(ColorBkg);
- tnsPackAs(GL_TRIANGLE_FAN);
- int tl,tr,tu,sl,sr,su;
- if(ui->Flags&LA_UI_SOCKET_LABEL_N){ tl=ui->L; tu=ui->U; tr=ui->R; sl=ui->L; sr=ui->R; su=ui->U+LA_RH; }
- elif(ui->Flags&LA_UI_SOCKET_LABEL_S){ tl=ui->L; tu=ui->U+LA_RH; tr=ui->R; sl=ui->L; sr=ui->R; su=ui->U; }
- elif(ui->Flags&LA_UI_SOCKET_LABEL_W){ tl=ui->L; tu=ui->U; tr=tl+LA_2RH; sl=ui->L+LA_2RH; sr=ui->R; su=ui->U; }
- elif(ui->Flags&LA_UI_SOCKET_LABEL_E){ tu=ui->U; tr=ui->R; tl=tr-LA_2RH; sl=ui->L; sr=tl; su=ui->U; }
- else{ sl=ui->L; su=ui->U; sr=ui->R; label=0; }
- tnsDrawStringAuto("⭗", IsDisabled?laThemeColor(bt,LA_BT_TEXT|LA_UI_DISABLED):ColorSocket, sl, sr, su, LA_TEXT_ALIGN_CENTER);
- if(label) tnsDrawStringAuto(label, IsDisabled?laThemeColor(bt,LA_BT_TEXT|LA_UI_DISABLED):ColorSocket, tl, tr, tu, LA_TEXT_ALIGN_CENTER|LA_TEXT_MONO);
- }
- void la_HeightAdjusterDraw(laUiItem *ui, int h){
- laBoxedTheme *bt = (*ui->Type->Theme);
- char* str="☰";
- if(ui->State==LA_BT_ACTIVE){ str="🡙"; }
- tnsDrawStringAuto(str, laThemeColor(bt,LA_BT_TEXT), ui->L-1000, ui->R+1000, ui->U, LA_TEXT_ALIGN_CENTER);
- }
- void la_RawPropDraw(laUiItem *ui, int h){
- laBoxedTheme *bt = (*ui->Type->Theme);
- int s=0;
- //void* data=laGetRaw(&ui->PP, &s);
- //char* buf[128]; sprintf(buf,"%d bytes of raw data at 0x%0x", s, data);
- tnsDrawStringAuto("RAW DATA", laThemeColor(bt,LA_BT_TEXT), ui->L, ui->R, ui->U, ui->Flags|LA_TEXT_MONO);
- }
- void la_MapperDraw(laUiItem *ui, int h){
- laBoxedTheme *bt = (*ui->Type->Theme);
- int NoDecal=ui->Flags&LA_UI_FLAGS_NO_DECAL;
- if(!NoDecal){
- tnsUseNoTexture();
- tnsColor4dv(laThemeColor(bt, LA_BT_NORMAL));
- tnsVertex2d(ui->L, ui->U); tnsVertex2d(ui->R, ui->U);
- tnsVertex2d(ui->R, ui->B); tnsVertex2d(ui->L, ui->B);
- tnsPackAs(GL_TRIANGLE_FAN);
- tnsColor4dv(laThemeColor(bt, LA_BT_BORDER));
- tnsVertex2d(ui->L, ui->U); tnsVertex2d(ui->R, ui->U);
- tnsVertex2d(ui->R, ui->B); tnsVertex2d(ui->L, ui->B);
- tnsPackAs(GL_LINE_LOOP);
- }
- laPropContainer* pc=la_EnsureSubTarget(ui->PP.LastPs->p,ui->PP.EndInstance);
- if(!pc || pc!=LA_PC_MAPPER || !ui->PP.EndInstance){
- tnsDrawStringAuto("Property is not a la_value_mapper.",0,ui->L+bt->LM,ui->R-bt->RM,bt->TM,LA_TEXT_LINE_WRAP); return;
- }
- laValueMapper* vm=ui->PP.EndInstance; int any=0;
- tnsColor4dv(laAccentColor(LA_BT_TEXT));
- for(laValueMapperPoint* vmp=vm->Points.pFirst;vmp;vmp=vmp->Item.pNext){
- tnsVertex2d(tnsInterpolate(ui->L,ui->R,vmp->x),tnsInterpolate(ui->B,ui->U,vmp->y)); any++;
- } tnsPackAs(GL_LINE_STRIP);
- for(laValueMapperPoint* vmp=vm->Points.pFirst;vmp;vmp=vmp->Item.pNext){
- tnsVertex2d(tnsInterpolate(ui->L,ui->R,vmp->x),tnsInterpolate(ui->B,ui->U,vmp->y));
- } tnsPackAs(GL_POINTS);
- if(any){ glLineWidth(2); glPointSize(5); tnsFlush(); glPointSize(1); glLineWidth(1); }
- }
- void la_ImageDraw(laUiItem *ui, int h){
- laBoxedTheme *bt = (*ui->Type->Theme);
- tnsImage* im=ui->Extra;
- if(!im->Texture) { tns_ImageToTexture(im); }
- if(!im->Texture) {
- tnsUseNoTexture();
- tnsColor4dv(laThemeColor(bt,LA_BT_BORDER));
- tnsVertex2d(ui->L, ui->U); tnsVertex2d(ui->R, ui->U);
- tnsVertex2d(ui->R, ui->B); tnsVertex2d(ui->L, ui->B);
- tnsPackAs(GL_LINE_LOOP);
- tnsVertex2d(ui->L, ui->U); tnsVertex2d(ui->R, ui->B);
- tnsVertex2d(ui->R, ui->U); tnsVertex2d(ui->L, ui->B);
- tnsPackAs(GL_LINES);
- return;
- }
- int W=im->Texture->Width, H=im->Texture->Height;
- int Full=ui->Flags&LA_UI_IMAGE_FULL_W;
- real r=(real)(ui->R-ui->L)/W; if(r<1){W*=r;H*=r;}
- real UseW=Full?(W):((real)LA_RH*ui->SymbolID/H*W);
- real L=(ui->R-ui->L-UseW)/2,U=0,UseH=Full?H:(ui->B-ui->U);
- if(Full){ U=(ui->B-ui->U-H)/2; }
- if(ui->Flags&LA_TEXT_ALIGN_CENTER){ L=0; }
- elif(ui->Flags&LA_TEXT_ALIGN_RIGHT){ L=ui->R-ui->L-UseW; }
- tnsDraw2DTextureDirectly(im->Texture,ui->L+L,ui->U+U,UseW,UseH);
- tnsFlush();
- }
- void la_ValueMeterType1Draw(laUiItem *ui, int h){
- laBoxedTheme *bt = (*ui->Type->Theme);
- int DataI[8]; real Data[8];
- int Len, i, W; real Seg;
- char buf[48] = {0};
- char buf2[48] = {0};
- char prefix[8][64] = {0};
- int Original;
- int Imin=-100, Imax=100;
- real min=-100, max=100;
- int s, State; int IsVertical=ui->Flags&LA_UI_FLAGS_TRANSPOSE;
- int NoLabel=ui->Flags&LA_UI_FLAGS_NO_LABEL;
- int IsInt=(ui->PP.LastPs->p->PropertyType&LA_PROP_INT)?1:0;
- Len = laGetArrayLength(&ui->PP);
- laGetPrefixP(&ui->PP, prefix);
- if(IsInt){
- laGetIntArray(&ui->PP, DataI); for(int i=0;i<Len;i++){ Data[i]=DataI[i]; }
- laGetIntRange(&ui->PP, &Imin, &Imax); min=Imin; max=Imax;
- }else{
- laGetFloatArray(&ui->PP, Data);
- laGetFloatRange(&ui->PP,&min,&max);
- }
- for (i = 0; i < Len; i++){
- int _L=ui->L, _R=ui->R, _U=ui->U, _B=ui->B;
- if(IsVertical){
- Seg = (real)(ui->R-ui->L)/Len;
- _L = ui->L + i * Seg; _R=ui->L + (i+1) * Seg;
- }else{
- Seg = (real)(ui->B-ui->U)/Len;
- _U = ui->U + i * Seg; _B=_U+Seg;
- }
- tnsUseNoTexture();
- tnsColor4dv(laThemeColor(bt,ui->State));
- tnsVertex2d(_L, _U); tnsVertex2d(_R, _U);
- tnsVertex2d(_R, _B); tnsVertex2d(_L, _B);
- tnsPackAs(GL_TRIANGLE_FAN);
- int oflow=0,ofhigh=0;
- if(Data[i]<min){ oflow=1; Data[i]=min; }
- if(Data[i]>max){ ofhigh=1; Data[i]=max; }
-
- int R1=_R,U1=_U;
- if(IsVertical){ U1 = (real)(max - Data[i]) / (real)(max - min) * (real)(_B-_U) + _U; }
- else{ R1 = (real)(Data[i] - min) / (real)(max - min) * (real)(_R-_L) + _L; }
- tnsUseNoTexture(); real* color=laThemeColor(bt,LA_BT_TEXT);
- tnsColor4d(LA_COLOR3(color),0.4);
- tnsVertex2d(_L, U1); tnsVertex2d(R1, U1);
- tnsVertex2d(R1, _B); tnsVertex2d(_L, _B);
- tnsPackAs(GL_TRIANGLE_FAN);
- tnsColor4dv(laThemeColor(bt,LA_BT_BORDER));
- tnsVertex2d(_L, _U); tnsVertex2d(_R, _U);
- tnsVertex2d(_R, _B); tnsVertex2d(_L, _B);
- tnsPackAs(GL_LINE_LOOP);
- if(!NoLabel){
- if(Len==1){ sprintf(buf,ui->PP.LastPs->p->Name); } else{ if(i<8)sprintf(buf,prefix[i]); }
- if(buf[0]) tnsDrawStringAuto(buf, laThemeColor(bt, LA_BT_TEXT), _L + bt->LM, _R - bt->RM, _U, ui->Flags);//, ui->ExtraInstructions);
- }
- if(IsVertical){
- if(oflow){ tnsDrawStringAuto("⯆",laThemeColor(bt, LA_BT_TEXT), _L+bt->LM,_R-bt->RM, _U, LA_TEXT_ALIGN_CENTER); }
- elif(ofhigh){ tnsDrawStringAuto("⯅",laThemeColor(bt, LA_BT_TEXT), _L+bt->LM,_R-bt->RM, _B-LA_RH, LA_TEXT_ALIGN_CENTER); }
- }else{
- if(oflow){ tnsDrawStringAuto("⯇",laThemeColor(bt, LA_BT_TEXT), _L+bt->LM,_R-bt->RM, _U, LA_TEXT_ALIGN_LEFT); }
- elif(ofhigh){ tnsDrawStringAuto("⯈",laThemeColor(bt, LA_BT_TEXT), _L+bt->LM,_R-bt->RM, _U, LA_TEXT_ALIGN_RIGHT); }
- }
- }
- int trisize=LA_RH/3.0f;
- for(laCompoundPP* CPP=ui->CompoundPPs.pFirst;CPP;CPP=CPP->Item.pNext){
- IsInt=(CPP->PP.LastPs->p->PropertyType&LA_PROP_INT)?1:0;
- Len = laGetArrayLength(&CPP->PP);
- laGetPrefixP(&CPP->PP, prefix);
- if(IsInt){
- laGetIntArray(&CPP->PP, DataI); for(int i=0;i<Len;i++){ Data[i]=DataI[i]; }
- laGetIntRange(&CPP->PP, &Imin, &Imax); min=Imin; max=Imax;
- }else{
- laGetFloatArray(&CPP->PP, Data);
- laGetFloatRange(&CPP->PP,&min,&max);
- }
- if(CPP->Slot <= LA_SLOT_MARKER_4){
- for (i = 0; i < Len; i++){
- int _L=ui->L, _R=ui->R, _U=ui->U, _B=ui->B;
- if(IsVertical){
- Seg = (real)(ui->R-ui->L)/Len;
- _L = ui->L + i * Seg; _R=ui->L + (i+1) * Seg;
- }else{
- Seg = (real)(ui->B-ui->U)/Len;
- _U = ui->U + i * Seg; _B=_U+Seg;
- }
- int R1=_R,U1=_U;
- if(IsVertical){ U1 = (real)(max - Data[i]) / (real)(max - min) * (real)(_B-_U) + _U; }
- else{ R1 = (real)(Data[i] - min) / (real)(max - min) * (real)(_R-_L) + _L; }
-
- tnsUseNoTexture();
- tnsColor4dv(laAccentColor(LA_BT_TEXT));
- if(IsVertical){ tnsVertex2d(_L, U1); tnsVertex2d(R1, U1); }
- else{ tnsVertex2d(R1, U1); tnsVertex2d(R1, _B); }
- tnsPackAs(GL_LINES);
- if(IsVertical){
- if(! CPP->Slot % 2){ tnsVertex2d(_L, U1+trisize); tnsVertex2d(_L+trisize, U1); tnsVertex2d(_L, U1-trisize); }
- else{ tnsVertex2d(_R, U1+trisize); tnsVertex2d(_R-trisize, U1); tnsVertex2d(_R, U1-trisize); }
- }
- else{
- if(! CPP->Slot % 2){ tnsVertex2d(R1-trisize, _B); tnsVertex2d(R1, _B-trisize); tnsVertex2d(R1+trisize, _B); }
- else{ tnsVertex2d(R1-trisize, U1); tnsVertex2d(R1, U1+trisize); tnsVertex2d(R1+trisize, U1); }
- }
- tnsPackAs(GL_TRIANGLES);
- }
- }
- }
- tnsFlush();
- }
- void la_ValueMeterType2Draw(laUiItem *ui, int h){
- laBoxedTheme *bt = (*ui->Type->Theme);
- int DataI[8]; real Data[8]; int SDataI[8]; real SData[8]; int Len, i, W; real Seg;
- char buf[48] = {0}; char buf2[48] = {0};char prefix[16][64] = {0};char limits[2][64]={0};
- int Original;
- int Imin=-100, Imax=100; real min=-100, max=100;
- int s, State; int IsVertical=ui->Flags&LA_UI_FLAGS_TRANSPOSE;
- int NoLabel=ui->Flags&LA_UI_FLAGS_NO_LABEL;
- int IsInt=(ui->PP.LastPs->p->PropertyType&LA_PROP_INT)?1:0;
- Len = laGetArrayLength(&ui->PP);
- laGetPrefixP(&ui->PP, prefix);
- if(IsInt){
- laGetIntArray(&ui->PP, DataI); for(int i=0;i<Len;i++){ Data[i]=DataI[i]; }
- laGetIntRange(&ui->PP, &Imin, &Imax); min=Imin; max=Imax;
- sprintf(limits[0],"%d",Imin); sprintf(limits[1],"%d",Imax);
- }else{
- laGetFloatArray(&ui->PP, Data);
- laGetFloatRange(&ui->PP,&min,&max);
- sprintf(limits[0],"%lf",min); sprintf(limits[1],"%lf",max);
- }
- int sl = TNS_MAX2(abs(ui->SymbolID),5);
- int ScaleLen = sl * LA_RH;
- real seg = abs(ui->TemplateContext)/100;
- int times=1,times10=0;
- while((max-min)/seg > ScaleLen/10){
- seg*=10;
- }
- if(seg>100){ int sseg=seg; while(sseg>=100){ sseg/=10; times*=10; times10++; } }
- for (i = 0; i < Len; i++){
- int _L=ui->L, _R=ui->R, _U=ui->U, _B=ui->B;
- if(IsVertical){
- Seg = (real)(ui->R-ui->L)/Len;
- _L = ui->L + i * Seg; _R=ui->L + (i+1) * Seg;
- }else{
- Seg = (real)(ui->B-ui->U)/Len;
- _U = ui->U + i * Seg; _B=_U+Seg;
- }
- real cx=(_L+_R)/2,cy=(_U+_B)/2,cw=(_R-_L),ch=(_B-_U);
-
- tnsPushStringClip(_L,_R,_U,_B);
- tnsUseNoTexture();
- tnsColor4dv(laThemeColor(bt,ui->State));
- tnsVertex2d(_L, _U); tnsVertex2d(_R, _U);
- tnsVertex2d(_R, _B); tnsVertex2d(_L, _B);
- tnsPackAs(GL_TRIANGLE_FAN);
- int oflow=0,ofhigh=0;
- if(Data[i]<min){ oflow=1; Data[i]=min; }
- if(Data[i]>max){ ofhigh=1; Data[i]=max; }
-
- real fac = (real)(Data[i]-min) / (real)(max - min);
- int SL,SR,SU,SB,_SL,_SR,_SU,_SB,Move = fac*ScaleLen;
- if(IsVertical){ SL=_L; SR=_R; SB=_SB=cy+Move; SU=_SU=SB-ScaleLen; TNS_CLAMP(SB,_U,_B); TNS_CLAMP(SU,_U,_B); }
- else{ SL=_SL=cx-Move; SR=_SR=SL+ScaleLen; SB=_B; SU=_U; TNS_CLAMP(SL,_L,_R); TNS_CLAMP(SR,_L,_R); }
- tnsUseNoTexture(); real* color=laThemeColor(bt,LA_BT_TEXT);
- tnsColor4d(LA_COLOR3(color),0.3);
- tnsVertex2d(SL, SU); tnsVertex2d(SR, SU);
- tnsVertex2d(SR, SB); tnsVertex2d(SL, SB);
- tnsPackAs(GL_TRIANGLE_FAN);
- tnsColor4d(LA_COLOR3(color),0.7);
- int scalelow=min/seg-1, scalehigh=max/seg+1;
- for(int si=scalelow;si<=scalehigh;si++){
- for(int ssi=0;ssi<10;ssi++){
- real val=si*seg + ssi*0.1*seg; if(val<min) continue; if(val>max) break;
- real sfac = (real)(val-min) / (max - min); int smove=Move-sfac*ScaleLen;
- real lfac = ssi==0?(si==ssi?0.5:0.3):(ssi==5?0.2:0.1);
- if(IsVertical){ int scaleb=cy+smove; if(scaleb>_B || scaleb<_U) continue;
- tnsVertex2d(cx-cw*lfac,scaleb); tnsVertex2d(cx+cw*lfac,scaleb);
- }else{ int scalel=cx-smove; if(scalel<_L || scalel>_R) continue;
- tnsVertex2d(scalel,cy+ch*lfac); tnsVertex2d(scalel,cy-ch*lfac);
- }
- }
- }
- tnsPackAs(GL_LINES);
- if(!NoLabel){
- for(int si=scalelow;si<=scalehigh;si++){
- real val=si*seg; if(val<min) continue; if(val>max) break;
- real sfac = (real)(val-min) / (max - min); int smove=Move-sfac*ScaleLen;
- if(IsInt) sprintf(buf,"%.0lf",val/times); else sprintf(buf,"%.2lf",val/times);
- if(IsVertical){ int scaleb=cy+smove; if(scaleb>_B+LA_RH2 || scaleb<_U-LA_RH2) continue;
- tnsDrawStringAuto(buf,laThemeColor(bt,LA_BT_TEXT),_L+bt->LM,_R-bt->RM,scaleb-LA_RH2,ui->Flags);
- }else{ int scalel=cx-smove; if(scalel<_L-100 || scalel>_R+100) continue;
- tnsDrawStringAuto(buf,laThemeColor(bt,LA_BT_TEXT),scalel-100,scalel+100,_U,ui->Flags);
- }
- }
- if(IsVertical){
- tnsDrawStringAuto(limits[0],laThemeColor(bt,LA_BT_TEXT|ui->State),_L+bt->LM,_R-bt->RM,_SB,ui->Flags);
- tnsDrawStringAuto(limits[1],laThemeColor(bt,LA_BT_TEXT|ui->State),_L+bt->LM,_R-bt->RM,_SU-LA_RH,ui->Flags);
- }else{
- tnsDrawStringAuto(limits[0],laThemeColor(bt,LA_BT_TEXT|ui->State),_SL-100,_SL-bt->LM,_B-LA_RH,LA_TEXT_ALIGN_RIGHT);
- tnsDrawStringAuto(limits[1],laThemeColor(bt,LA_BT_TEXT|ui->State),_SR+bt->RM,_SR+100,_B-LA_RH,LA_TEXT_ALIGN_LEFT);
- }
- }
- tnsUseNoTexture();
- tnsColor4dv(laAccentColor(LA_BT_BORDER));
- if(IsVertical){tnsVertex2d(_L,cy); tnsVertex2d(_R,cy);}
- else{tnsVertex2d(cx,_U); tnsVertex2d(cx,_B);}
- tnsPackAs(GL_LINES);
- if(times!=1){ sprintf(buf,"%d",times10);
- if(IsVertical && cw>LA_RH) tnsDrawStringAuto(buf,laAccentColor(LA_BT_BORDER),_L+bt->LM,_R-bt->RM,cy,LA_TEXT_MONO|LA_TEXT_ALIGN_RIGHT);
- elif(ch>LA_RH) tnsDrawStringAuto(buf,laAccentColor(LA_BT_BORDER),cx+bt->LM,cx+100,_U,LA_TEXT_MONO|LA_TEXT_ALIGN_LEFT);
- }
- tnsUseNoTexture();
- tnsColor4dv(laThemeColor(bt,LA_BT_BORDER));
- tnsVertex2d(_L, _U); tnsVertex2d(_R, _U);
- tnsVertex2d(_R, _B); tnsVertex2d(_L, _B);
- tnsPackAs(GL_LINE_LOOP);
- //if(IsVertical){
- // if(oflow){ tnsDrawStringAuto("⯆",laThemeColor(bt, LA_BT_TEXT), _L+bt->LM,_R-bt->RM, _U, LA_TEXT_ALIGN_CENTER); }
- // elif(ofhigh){ tnsDrawStringAuto("⯅",laThemeColor(bt, LA_BT_TEXT), _L+bt->LM,_R-bt->RM, _B-LA_RH, LA_TEXT_ALIGN_CENTER); }
- //}else{
- // if(oflow){ tnsDrawStringAuto("⯇",laThemeColor(bt, LA_BT_TEXT), _L+bt->LM,_R-bt->RM, _U, LA_TEXT_ALIGN_LEFT); }
- // elif(ofhigh){ tnsDrawStringAuto("⯈",laThemeColor(bt, LA_BT_TEXT), _L+bt->LM,_R-bt->RM, _U, LA_TEXT_ALIGN_RIGHT); }
- //}
- tnsPopStringClip();
- }
- int trisize=LA_RH/3.0f;
- for(laCompoundPP* CPP=ui->CompoundPPs.pFirst;CPP;CPP=CPP->Item.pNext){
- IsInt=(CPP->PP.LastPs->p->PropertyType&LA_PROP_INT)?1:0;
- Len = laGetArrayLength(&CPP->PP);
- laGetPrefixP(&CPP->PP, prefix);
- if(IsInt){
- laGetIntArray(&CPP->PP, SDataI); for(int i=0;i<Len;i++){ SData[i]=SDataI[i]; }
- //laGetIntRange(&CPP->PP, &Imin, &Imax); min=Imin; max=Imax;
- }else{
- laGetFloatArray(&CPP->PP, SData);
- //laGetFloatRange(&CPP->PP,&min,&max);
- }
- if(CPP->Slot <= LA_SLOT_MARKER_4){
- for (i = 0; i < Len; i++){
- int _L=ui->L, _R=ui->R, _U=ui->U, _B=ui->B;
- if(IsVertical){
- Seg = (real)(ui->R-ui->L)/Len;
- _L = ui->L + i * Seg; _R=ui->L + (i+1) * Seg;
- }else{
- Seg = (real)(ui->B-ui->U)/Len;
- _U = ui->U + i * Seg; _B=_U+Seg;
- }
- real cx=(_L+_R)/2,cy=(_U+_B)/2,cw=(_R-_L),ch=(_B-_U);
- real sfac = (real)(SData[i]-min) / (real)(max - min);
- real fac = (real)(Data[i]-min) / (real)(max - min);
- int SL,SR,SU,SB,_SL,_SR,_SU,_SB, Move = fac*ScaleLen,SMove=sfac*ScaleLen;
- if(IsVertical){ _SB=SB=cy+Move-SMove; TNS_CLAMP(SB,_U,_B); }
- else{ SL=_SL=cx-Move+SMove; TNS_CLAMP(SL,_L,_R); }
-
- tnsUseNoTexture();
- tnsColor4dv(laThemeColor(bt,LA_BT_TEXT|LA_BT_ACTIVE));
- if(IsVertical){ tnsVertex2d(_L, SB); tnsVertex2d(_R, SB); }
- else{ tnsVertex2d(SL, _U); tnsVertex2d(SL, _B); }
- tnsPackAs(GL_LINES);
- if(IsVertical){
- if(! CPP->Slot % 2){ tnsVertex2d(_L, SB); tnsVertex2d(_L+trisize, SB); tnsVertex2d(_L, SB-trisize); }
- else{ tnsVertex2d(_R, SB+trisize); tnsVertex2d(_R-trisize, SB); tnsVertex2d(_R, SB); }
- if(SB==_SB){ tnsPackAs(GL_TRIANGLES); }else{ tnsPackAs(GL_LINE_LOOP); }
- }
- else{
- if(! CPP->Slot % 2){ tnsVertex2d(SL, _B); tnsVertex2d(SL, _B-trisize); tnsVertex2d(SL+trisize, _B); }
- else{ tnsVertex2d(SL-trisize, _U); tnsVertex2d(SL, _U+trisize); tnsVertex2d(SL, _U); }
- if(SL==_SL){ tnsPackAs(GL_TRIANGLES); }else{ tnsPackAs(GL_LINE_LOOP); }
- }
- }
- }
- }
- tnsFlush();
- }
- void la_ValueMeter2DDraw(laUiItem *ui, int h){
- laBoxedTheme *bt = (*ui->Type->Theme);
- int DataI[8]; real Data[8];
- int Len, i, W; real Seg;
- char buf[48] = {0};
- char buf2[48] = {0};
- char prefix[8][64] = {0};
- int Original;
- int Imin=-100, Imax=100;
- real min=-100, max=100;
- int IsInt=(ui->PP.LastPs->p->PropertyType&LA_PROP_INT)?1:0;
- Len = laGetArrayLength(&ui->PP);
- laGetPrefixP(&ui->PP, prefix);
- if(IsInt){
- laGetIntArray(&ui->PP, DataI); for(int i=0;i<Len;i++){ Data[i]=DataI[i]; }
- laGetIntRange(&ui->PP, &Imin, &Imax); min=Imin; max=Imax;
- }else{
- laGetFloatArray(&ui->PP, Data);
- laGetFloatRange(&ui->PP,&min,&max);
- }
- int _L=ui->L, _R=ui->R, _U=ui->U, _B=ui->B;
- tnsUseNoTexture();
- tnsColor4dv(laThemeColor(bt,LA_BT_NORMAL));
- tnsVertex2d(_L, _U); tnsVertex2d(_R, _U);
- tnsVertex2d(_R, _B); tnsVertex2d(_L, _B);
- tnsPackAs(GL_TRIANGLE_FAN);
- real CL=(real)(Data[0] - min) / (real)(max - min) * (real)(_R-_L) + _L;
- real CU=(real)(max - Data[1]) / (real)(max - min) * (real)(_B-_U) + _U;
- real HW=((real)_R-(real)_L)/4; real HH=((real)_B-(real)_U)/4;
- real ML=((real)_R+(real)_L)/2; real MU=((real)_B+(real)_U)/2;
- tnsUseNoTexture(); real* color=laThemeColor(bt,LA_BT_TEXT);
- tnsColor4d(LA_COLOR3(color),0.4);
- tnsVertex2d(ML+HW, MU+HH); tnsVertex2d(ML-HW, MU+HH);
- tnsVertex2d(ML-HW, MU-HH); tnsVertex2d(ML+HW, MU-HH);
- tnsPackAs(GL_LINE_LOOP);
- tnsVertex2d(_L,_U); tnsVertex2d(_R,_B);
- tnsVertex2d(_R,_U); tnsVertex2d(_L,_B);
- tnsVertex2d(ML,_U); tnsVertex2d(ML,_B);
- tnsVertex2d(_R,MU); tnsVertex2d(_L,MU);
- tnsPackAs(GL_LINES);
- tnsColor4dv(laThemeColor(bt,LA_BT_BORDER));
- tnsVertex2d(_L, _U); tnsVertex2d(_R, _U);
- tnsVertex2d(_R, _B); tnsVertex2d(_L, _B);
- tnsPackAs(GL_LINE_LOOP);
- tnsFlush();
- tnsColor4dv(laThemeColor(bt,LA_BT_TEXT));
- tnsVertex2d(_L, CU); tnsVertex2d(_R, CU);
- tnsVertex2d(CL, _U); tnsVertex2d(CL, _B);
- tnsPackAs(GL_LINES);
- real circle[48];
- tnsMakeCircle2d(circle,24,CL,CU,LA_RH2,0);
- tnsVertexArray2d(circle,24);
- tnsPackAs(GL_LINE_LOOP);
- glLineWidth(2);
- tnsFlush();
- glLineWidth(1);
- }
- void la_ScopeDraw(laUiItem *ui, int h){
- laBoxedTheme *bt = (*ui->Type->Theme); laSynthNodeScope* s=ui->PP.EndInstance;
- if(!s) return;
- real* lcolor=laAccentColor(LA_BT_TEXT); int plen=LA_SYNTH_PLEN;
- int cl=ui->L+2, cr=ui->R-2, cu=ui->U+2, cb=ui->B-2; real cc=(real)(cu+cb)/2;
- real yfac1=(real)(1<<(s->Gain1+1))/4.0f, yfac2=(real)(1<<(s->Gain2+1))/4.0f; yfac1/=10; yfac2/=10;
- real off1=s->Offset1/20*(cb-cu), off2=s->Offset2/20*(cb-cu);
- real arrx[LA_SYNTH_PLEN];
- real arru1[LA_SYNTH_PLEN],arrb1[LA_SYNTH_PLEN];
- real arru2[LA_SYNTH_PLEN],arrb2[LA_SYNTH_PLEN];
- tnsFlush(); tnsUseNoTexture();
-
- tnsColor4d(0,0,0,0.8);
- tnsVertex2d(ui->L,ui->U); tnsVertex2d(ui->R,ui->U);
- tnsVertex2d(ui->R,ui->B); tnsVertex2d(ui->L,ui->B);
- tnsPackAs(GL_TRIANGLE_FAN);
- tnsFlush(); tnsLineWidth(3.0);
- laSpinLock(&s->Lock);
- real b1=s->Brightness1, b2=s->Brightness2; real hcy[3]; tnsRGB2HCY(lcolor,hcy); hcy[2]=0.75;
- real c1[3]; tnsHCY2RGB(hcy,c1);
- for(int i=0;i<plen;i++){
- arrx[i]=tnsInterpolate(cl,cr,((real)i)/plen);
- arru1[i]=tnsInterpolate(cc,cu,yfac1*s->Display1[i])-off1;
- arrb1[i]=tnsInterpolate(cc,cu,yfac1*s->Display1[i+plen])-off1;
- TNS_CLAMP(arru1[i],cu,cb); TNS_CLAMP(arrb1[i],cu,cb);
- tnsVertex2d(arrx[i],arru1[i]); tnsVertex2d(arrx[i],arrb1[i]);
- }
- tnsColor4d(LA_COLOR3(c1),b1*0.4);
- tnsPackAs(GL_TRIANGLE_STRIP); tnsFlush();
- for(int i=0;i<plen;i++){
- arru2[i]=tnsInterpolate(cc,cu,yfac2*s->Display2[i])-off2;
- arrb2[i]=tnsInterpolate(cc,cu,yfac2*s->Display2[i+plen])-off2;
- TNS_CLAMP(arru2[i],cu,cb); TNS_CLAMP(arrb2[i],cu,cb);
- tnsVertex2d(arrx[i],arru2[i]); tnsVertex2d(arrx[i],arrb2[i]);
- }
- tnsColor4d(LA_COLOR3(c1),b2*0.6);
- tnsPackAs(GL_TRIANGLE_STRIP); tnsFlush();
- for(int i=0;i<plen;i++){ tnsVertex2d(arrx[i],arru1[i]); }
- tnsColor4d(LA_COLOR3(c1),b1);
- tnsPackAs(GL_LINE_STRIP);
- for(int i=0;i<plen;i++){ tnsVertex2d(arrx[i],arrb1[i]); }
- tnsColor4d(LA_COLOR3(c1),b1);
- tnsPackAs(GL_LINE_STRIP);
- for(int i=0;i<plen;i++){ tnsVertex2d(arrx[i],arru2[i]); }
- tnsColor4d(LA_COLOR3(c1),b2);
- tnsPackAs(GL_LINE_STRIP);
- for(int i=0;i<plen;i++){ tnsVertex2d(arrx[i],arrb2[i]); }
- tnsColor4d(LA_COLOR3(c1),b2);
- tnsPackAs(GL_LINE_STRIP);
- laSpinUnlock(&s->Lock);
- tnsFlush(); tnsLineWidth(1.0);
- tnsColor4dv(laThemeColor(bt,LA_BT_BORDER));
- tnsVertex2d(ui->L,ui->U); tnsVertex2d(ui->R,ui->U);
- tnsVertex2d(ui->R,ui->B); tnsVertex2d(ui->L,ui->B);
- tnsPackAs(GL_LINE_LOOP);
- if(s->FromSynth && laget_SynthPlaying(s->FromSynth)){ laDeferredRedraw(MAIN.CurrentPanel); }
- }
- void la_ConditionNodeFreeRecursive(laUiConditionNode *ucn);
- void la_GeneralUiInit(laUiItem *ui){
- ui->Extra = memAcquireSimple(sizeof(laGeneralUiExtraData));
- ui->Extra->ui=ui;
- }
- void la_GeneralUiDestroy(laUiItem *ui){
- if(ui->Extra && ui->Extra->Edit){ strEndEdit(&ui->Extra->Edit, 1); }
- memFree(ui->Extra);
- }
- void la_ConditionUiDestroy(laUiItem *ui){
- laConditionUiExtraData *cued = ui->Extra;
- la_ConditionNodeFreeRecursive(cued->Expression);
- FreeMem(ui->Extra);
- }
- void la_MultiStringInit(laUiItem *ui){
- laGeneralUiExtraData *e = ui->Extra;
- if (!e) e = memAcquireSimple(sizeof(laGeneralUiExtraData));
- ui->Extra = e;
- e->HeightCoeff = 10;
- }
- void la_ImageUiInit(laUiItem *ui){
- tnsImage* im=ui->Extra;
- #ifdef LA_WITH_PNG
- tnsUseImage(im);
- #endif
- }
- void la_ImageUiDestroy(laUiItem *ui){
- tnsImage* im=ui->Extra;
- #ifdef LA_WITH_PNG
- tnsStopUsingImage(im);
- #endif
- //memAssignRef(ui, &ui->Extra, 0);
- }
- void la_MeterUiInit(laUiItem *ui){
- la_GeneralUiInit(ui); ui->SymbolID = 20; ui->TemplateContext = 1000;
- }
- void la_RegisterUiTypesBasic(){
- laKeyMapper* km;
- laPropContainer* pc;
- LA_WIDGET_INT->Type=LA_WIDGET_INT_PLAIN->Type=
- _LA_UI_INT = la_RegisterUiType("LA_int_array_horizon", LA_PROP_INT | LA_PROP_ARRAY, "LA_int_array_h_operator",
- &_LA_THEME_VALUATOR, la_IntDraw, la_ValueGetHeight, la_GeneralUiInit, la_GeneralUiDestroy);
- _LA_UI_INT->GetMinWidth=la_ValueGetMinWidth;
- LA_WIDGET_METER_TYPE1->Type=
- _LA_UI_METER_TYPE1 = la_RegisterUiType("LA_meter_type1", 0, 0, &_LA_THEME_VALUATOR, la_ValueMeterType1Draw, la_ValueMeterGetHeight, la_MeterUiInit, la_GeneralUiDestroy);
- _LA_UI_METER_TYPE1->GetMinWidth=la_ValueGetMinWidth;
- LA_WIDGET_METER_TYPE2->Type=
- _LA_UI_METER_TYPE2 = la_RegisterUiType("LA_meter_type2", 0, 0, &_LA_THEME_VALUATOR, la_ValueMeterType2Draw, la_ValueMeterGetHeight, la_MeterUiInit, la_GeneralUiDestroy);
- _LA_UI_METER_TYPE2->GetMinWidth=la_ValueGetMinWidth;
-
- LA_WIDGET_VALUE_METER_2D->Type=
- _LA_UI_VALUE_METER_2D = la_RegisterUiType("LA_value_meter_2d", 0, 0, &_LA_THEME_VALUATOR, la_ValueMeter2DDraw, la_ValueMeter2DGetHeight, la_MeterUiInit, la_GeneralUiDestroy);
- LA_WIDGET_FLOAT->Type=LA_WIDGET_FLOAT_PLAIN->Type=
- _LA_UI_FLOAT = la_RegisterUiType("LA_real_array_horizon", LA_PROP_FLOAT | LA_PROP_ARRAY, "LA_real_array_h_operator",
- &_LA_THEME_VALUATOR, la_FloatDraw, la_ValueGetHeight, la_GeneralUiInit, la_GeneralUiDestroy);
- _LA_UI_FLOAT->GetMinWidth=la_ValueGetMinWidth;
- LA_WIDGET_FLOAT_COLOR->Type=
- _LA_UI_FLOAT_COLOR = la_RegisterUiType("LA_real_color", LA_PROP_FLOAT | LA_PROP_ARRAY, "LA_real_color_operator",
- &_LA_THEME_VALUATOR, la_FloatArrayColorDraw, 0, la_GeneralUiInit, la_GeneralUiDestroy);
- _LA_UI_FLOAT_COLOR->GetMinWidth=la_ColorSelectorGetMinWidth;
- LA_WIDGET_FLOAT_COLOR_HCY->Type=
- _LA_UI_FLOAT_COLOR_HCY = la_RegisterUiType("LA_real_hcy", LA_PROP_FLOAT | LA_PROP_ARRAY, "LA_real_hcy_operator",
- &_LA_THEME_VALUATOR, la_ColorCircleDrawHCY, la_ColorPickerGetHeight, la_GeneralUiInit, la_GeneralUiDestroy);
- _LA_UI_FLOAT_COLOR_HCY->GetMinWidth = la_ColorPickerGetMinWidth;
- LA_WIDGET_ENUM_SELECTOR->Type=LA_WIDGET_ENUM_SELECTOR_ICON->Type=LA_WIDGET_ENUM_CYCLE->Type=LA_WIDGET_ENUM_HIGHLIGHT->Type=
- _LA_UI_ENUM_SELECTOR = la_RegisterUiType("LA_enum_selector", LA_PROP_ENUM, "LA_enum_selector_operator",
- &_LA_THEME_SELECTOR, la_EnumSelectorDraw, la_EnumGetHeight, la_GeneralUiInit, la_GeneralUiDestroy);
- _LA_UI_ENUM_SELECTOR->GetMinWidth = la_EnumGetMinWidth;
- LA_WIDGET_FIXED_GROUP->Type=
- _LA_UI_FIXED_GROUP = la_RegisterUiType("LA_group_default", 0, 0,
- &_LA_THEME_COLLECTION_GROUP, la_GroupDraw, la_GroupGetHeight, la_GeneralUiInit, la_GeneralUiDestroy);
- _LA_UI_FIXED_GROUP->Tag|=LA_UI_TAG_SCISSOR;
- LA_WIDGET_COLLECTION->Type=
- _LA_UI_COLLECTION = la_RegisterUiType("LA_collection_default", LA_PROP_SUB, "LA_collection_operator",
- &_LA_THEME_COLLECTION_GROUP, la_EmptyDraw, 0, la_GeneralUiInit, la_GeneralUiDestroy);
- LA_WIDGET_COLLECTION_SELECTOR->Type=
- _LA_UI_COLLECTION_SELECTOR = la_RegisterUiType("LA_collection_selector_default", LA_PROP_SUB, "LA_collection_selector_operator",
- &_LA_THEME_COLLECTION_SELECTOR, la_CollectionSelectorDraw, 0, la_GeneralUiInit, la_GeneralUiDestroy);
- _LA_UI_COLLECTION_SELECTOR->GetMinWidth = la_CollectionSimpleGetMinWidth;
- LA_WIDGET_COLLECTION_SINGLE->Type=
- _LA_UI_COLLECTION_SINGLE = la_RegisterUiType("LA_collection_single", LA_PROP_SUB, "LA_collection_operator",
- &_LA_THEME_COLLECTION_GROUP, la_EmptyDraw, 0, la_GeneralUiInit, la_GeneralUiDestroy);
- LA_WIDGET_TAB->Type=
- _LA_UI_TAB = la_RegisterUiType("LA_tab_default", 0, "LA_tab_operator",
- &_LA_THEME_TAB, la_TabDraw, 0, la_GeneralUiInit, la_GeneralUiDestroy);
- LA_WIDGET_BUTTON->Type=LA_WIDGET_BUTTON_NO_CONFIRM->Type=
- _LA_UI_BUTTON = la_RegisterUiType("LA_button_default", LA_PROP_OPERATOR, "LA_button_operator",
- &_LA_THEME_BUTTON, la_ButtonDraw, 0, la_GeneralUiInit, la_GeneralUiDestroy);
- _LA_UI_BUTTON->GetMinWidth = la_ButtonGetMinWidth;
- LA_WIDGET_BUTTON_NO_CONFIRM->Flags|=LA_UI_FLAGS_NO_CONFIRM;
- pc=laUiHasExtraProps(_LA_UI_BUTTON, sizeof(laGeneralUiExtraData),0);
- LA_WIDGET_LABEL->Type=
- _LA_UI_LABEL = la_RegisterUiType("LA_label_default", LA_PROP_OPERATOR, 0,
- &_LA_THEME_LABEL, la_LabelDraw, la_LabelHeight, 0, 0);
- _LA_UI_LABEL->GetMinWidth = la_LabelGetMinWidth;
- LA_WIDGET_MENU_ROOT->Type=
- _LA_UI_MENU_ROOT = la_RegisterUiType("LA_menu_default", LA_PROP_OPERATOR, "LA_menu_root_operator",
- &_LA_THEME_BUTTON, la_MenuItemDraw, 0, 0, 0);
- _LA_UI_MENU_ROOT->GetMinWidth=la_LabelGetMinWidth;
- LA_WIDGET_CONDITION_TOGGLE->Type=
- _LA_UI_CONDITION_TOGGLE = la_RegisterUiType("LA_condition_toggle_default", LA_PROP_SELF_CONDITION, "LA_condition_toggle_operator",
- &_LA_THEME_BUTTON, la_ConditionToggleDraw, 0, 0, la_ConditionUiDestroy);
- LA_WIDGET_STRING->Type=LA_WIDGET_STRING_PLAIN->Type=LA_WIDGET_STRING_MONO_PLAIN->Type=
- _LA_UI_STRING = la_RegisterUiType("LA_string_default", LA_PROP_STRING, "LA_string_operator",
- &_LA_THEME_STRING, la_SingleLineStringDraw, la_StringPropGetHeight, la_GeneralUiInit, la_GeneralUiDestroy);
- _LA_UI_STRING->GetMinWidth = la_StringPropGetMinWidth;
- km=&_LA_UI_STRING->KeyMapper;
- laAssignNewKey(km, 0, "LA_edit_string_copy", LA_KM_SEL_UI_EXTRA, LA_KEY_CTRL, LA_KEY_DOWN, 'c', 0);
- laAssignNewKey(km, 0, "LA_edit_string_copy", LA_KM_SEL_UI_EXTRA, LA_KEY_CTRL, LA_KEY_DOWN, 'x', "mode=CUT");
- laAssignNewKey(km, 0, "LA_system_paste", 0, LA_KEY_CTRL, LA_KEY_DOWN, 'v', 0);
- pc=laUiHasExtraProps(_LA_UI_STRING, sizeof(laGeneralUiExtraData), 0);{
- laAddOperatorProperty(pc, "copy_selection", "Copy Selection", "Copy selected string into clipboard", "LA_edit_string_copy",0,0);
- }
- LA_WIDGET_STRING_MULTI->Type=
- _LA_UI_STRING_MULTI = la_RegisterUiType("LA_string_multiline", LA_PROP_STRING, "LA_string_multi",
- &_LA_THEME_STRING, la_MultiStringDraw, la_MultiStringHeight, la_MultiStringInit, la_GeneralUiDestroy);
- _LA_UI_STRING_MULTI->GetMinWidth = la_StringPropGetMinWidth;
- km=&_LA_UI_STRING_MULTI->KeyMapper;
- laAssignNewKey(km, 0, "LA_edit_string_copy", LA_KM_SEL_UI_EXTRA, LA_KEY_CTRL, LA_KEY_DOWN, 'c', 0);
- laAssignNewKey(km, 0, "LA_edit_string_copy", LA_KM_SEL_UI_EXTRA, LA_KEY_CTRL, LA_KEY_DOWN, 'x', "mode=CUT");
- laAssignNewKey(km, 0, "LA_system_paste", 0, LA_KEY_CTRL, LA_KEY_DOWN, 'v', 0);
- pc=laUiHasExtraProps(_LA_UI_STRING_MULTI, sizeof(laGeneralUiExtraData), 0);{
- laAddOperatorProperty(pc, "copy_selection", "Copy Selection", "Copy selected string into clipboard", "LA_edit_string_copy",0,0);
- }
- LA_WIDGET_ALIGN->Type=
- _LA_UI_ALIGN = la_RegisterUiType("LA_colum_align_default", 0, 0,
- &_LA_THEME_BUTTON, la_UiSeperatorDraw, 0, 0, 0);
- LA_WIDGET_COLUMN_ADJUSTER->Type=
- _LA_UI_COLUMN_ADJUSTER = la_RegisterUiType("LA_column_adjuster_default", 0, "LA_column_adjuster",
- &_LA_THEME_BUTTON, la_ColumnAdjusterDraw, 0, la_GeneralUiInit, la_GeneralUiDestroy);
- _LA_UI_COLUMN_ADJUSTER->TargetSub = "ui_column";
- LA_WIDGET_COLUMN_VIEWER->Type=
- _LA_UI_COLUMN_VIEWER = la_RegisterUiType("LA_column_viewer_default", 0, 0,
- &_LA_THEME_BUTTON, la_ColumnViewerDraw, 0, la_GeneralUiInit, la_GeneralUiDestroy);
- _LA_UI_COLUMN_VIEWER->TargetSub = "ui_column";
- _LA_UI_COLUMN_VIEWER->GetMinWidth = la_ColumnViewerGetMinWidth;
- _LA_UI_CONDITION_ELSE.Theme = &_LA_THEME_BUTTON;
- la_UDFAppendSharedTypePointer("LA_condition_else", &_LA_UI_CONDITION_ELSE);
- _LA_UI_CONDITION.Destroy = _LA_UI_CONDITION_ELSE.Destroy = _LA_UI_CONDITION_END.Destroy =la_ConditionUiDestroy;
- _LA_UI_CONDITION.Theme = &_LA_THEME_BUTTON;
- la_UDFAppendSharedTypePointer("LA_condition", &_LA_UI_CONDITION);
- _LA_UI_CONDITION_END.Theme = &_LA_THEME_BUTTON;
- la_UDFAppendSharedTypePointer("LA_condition_end", &_LA_UI_CONDITION_END);
- LA_WIDGET_SYMBOL->Type=
- _LA_UI_SYMBOL = la_RegisterUiType("LA_symbol_default", 0, 0, &_LA_THEME_BUTTON, la_SymbolDraw, la_SymbolGetHeight, 0, 0);
- LA_WIDGET_NODE_SOCKET->Type=
- _LA_UI_NODE_SOCKET = la_RegisterUiType("LA_node_socket_default", 0, "LA_node_socket", &_LA_THEME_SOCKET, la_NodeSocketDraw, la_SocketGetHeight, la_GeneralUiInit, la_GeneralUiDestroy);
- _LA_UI_NODE_SOCKET->GetMinWidth=la_SocketGetMinWidth;
-
- LA_WIDGET_HEIGHT_ADJUSTER->Type=
- _LA_UI_HEIGHT_ADJUSTER = la_RegisterUiType("LA_height_adjuster_default", 0, "LA_height_adjuster", &_LA_THEME_COLLECTION_GROUP, la_HeightAdjusterDraw, 0, la_GeneralUiInit, la_GeneralUiDestroy);
- _LA_UI_HEIGHT_ADJUSTER->ForType = LA_PROP_INT;
- LA_WIDGET_RAW->Type=
- _LA_UI_RAW = la_RegisterUiType("LA_raw_prop_default", 0, 0, &_LA_THEME_COLLECTION_GROUP, la_RawPropDraw, 0, 0, 0);
- _LA_UI_RAW->ForType = LA_PROP_RAW;
- LA_WIDGET_MAPPER->Type=
- _LA_UI_MAPPER = la_RegisterUiType("LA_mapper_default", 0, "LA_value_mapper", &_LA_THEME_COLLECTION_GROUP, la_MapperDraw, la_ColorPickerGetHeight, la_GeneralUiInit, la_GeneralUiDestroy);
- LA_WIDGET_IMAGE->Type=
- _LA_UI_IMAGE = la_RegisterUiType("LA_image_default", 0, 0, &_LA_THEME_COLLECTION_GROUP, la_ImageDraw, la_ImageGetHeight, la_ImageUiInit, la_ImageUiDestroy);
- _LA_UI_IMAGE->GetMinWidth=la_ImageGetMinWidth;
- LA_WIDGET_SCOPE->Type=
- _LA_UI_SCOPE = la_RegisterUiType("LA_scope_default", 0, "LA_synth_scope", &_LA_THEME_BUTTON, la_ScopeDraw, la_ColorPickerGetHeight, la_GeneralUiInit, la_GeneralUiDestroy);
- _LA_UI_INVISIBLE.Theme=&_LA_THEME_BUTTON;
- _LA_UI_ROW_BEGIN.Theme=&_LA_THEME_BUTTON;
- _LA_UI_ROW_END.Theme=&_LA_THEME_BUTTON;
- }
- // ============================================================ [Operators]
- void la_DefaultEnumPanel(laUiList *uil, laPropPack *This, laPropPack *OperatorProps, laColumn *UNUSED){
- laColumn *c = laFirstColumn(uil);
- laShowItem(uil, c, This, 0)->Flags=(LA_UI_FLAGS_TRANSPOSE|LA_UI_FLAGS_EXPAND);
- }
- int la_DetectRow(laUiItem *ui, int LocalY){
- return (LocalY - ui->U) / LA_RH;
- }
- int la_DetectColumn(laUiItem *ui, int LocalX, int Total){
- return (int)((real)(LocalX - ui->L) / (real)(ui->R - ui->L) * (real)Total);
- }
- laColumn *la_DetectSplit(laColumn *Root, int LocalX){
- laColumn *result = 0;
- if (!Root->LS) return 0;
- if (LocalX - Root->LS->IR < LA_SCROLL_W && Root->LS->IR - LocalX < LA_SCROLL_W &&
- !Root->LS->MaxW && !Root->RS->MaxW){
- return Root;
- }
- result = la_DetectSplit(Root->LS, LocalX);
- if (result) return result;
- else
- return la_DetectSplit(Root->RS, LocalX);
- }
- void la_AdjustColumnSplit(laColumn *c, int PxLeftPositive){
- if (!c->LS || c->LS->MaxW || c->RS->MaxW) return;
- if (PxLeftPositive < 0 && c->LS->IR - c->LS->IL <= LA_SCROLL_W*2) return;
- if (PxLeftPositive > 0 && c->RS->IR - c->RS->IL <= LA_SCROLL_W*2) return;
- c->LS->IR += PxLeftPositive;
- c->RS->IL += PxLeftPositive;
- c->LS->SP = (real)(c->LS->IR - c->LS->IL) / (real)(c->IR - c->IL);
- c->RS->SP = c->LS->SP;
- }
- int OPCHK_EditStringCopySelection(laPropPack *This, laStringSplitor *Instructions){
- laGeneralUiExtraData *uit = This->EndInstance; if(!uit) return 0;
- if(!uit->Edit || !strHasSelection(uit->Edit)) return 0;
- return 1;
- }
- int OPINV_EditStringCopySelection(laOperator *a, laEvent *e){
- laGeneralUiExtraData *uit = a->This->EndInstance; if(!uit) return LA_FINISHED;
- if(!uit->Edit || !strHasSelection(uit->Edit)) return LA_FINISHED;
- char* mode=strGetArgumentString(a->ExtraInstructionsP,"mode");
- char* str=strGetEditString(uit->Edit, 1);
- laCopyToClipboard(str); free(str);
- if(strSame(mode,"CUT")){ strClearSelection(&uit->Edit); }
- return LA_FINISHED;
- }
- int la_ProcessTextEdit(laEvent *e, laStringEdit *se, laUiItem* ui){
- int Select=e->SpecialKeyBit&LA_KEY_SHIFT;
- real _L, MonoWidth;
- switch (e->type){
- case LA_INPUT:
- switch (e->Input){
- case 0x08: if(strHasSelection(se)) strClearSelection(se); else strBackspace(se); return 1;
- case 0x7f: if(strHasSelection(se)) strClearSelection(se); else { strMoveCursor(se,0,0); strBackspace(se); } return 1;
- case 0x09: strInsertChar(se, ' ');strInsertChar(se, ' ');strInsertChar(se, ' ');strInsertChar(se, ' '); return 1;
- case 0x1B: case 0x0D: return 0;
- default: strInsertChar(se, e->Input); return 1;
- }
- break;
- case LA_KEY_DOWN:
- switch (e->key){
- case LA_KEY_ENTER: strInsertChar(se, '\n'); return 1;
- case LA_KEY_ARRLEFT: strMoveCursor(se, 1, Select); return 1;
- case LA_KEY_ARRRIGHT: strMoveCursor(se, 0, Select); return 1;
- case LA_KEY_ARRUP: strMoveCursorLine(se, 1, Select); return 1;
- case LA_KEY_ARRDOWN: strMoveCursorLine(se, 0, Select); return 1;
- }
- break;
- case LA_L_MOUSE_DOWN:
- case LA_MOUSEMOVE:
- if(!ui) return 0;
- MonoWidth=tnsGetMonoFontAdvance(); _L=(*ui->Type->Theme)->LM*2+ui->L;
- int Count=se->TotalLines; while(Count){ Count/=10; _L+=MonoWidth; }
- if(e->type==LA_L_MOUSE_DOWN){
- strSetCursor(se, (e->y-ui->U)/LA_RH+se->ViewStartLine, (real)se->ViewStartCol+((real)e->x-_L)/MonoWidth+0.5); strCancelSelect(se); strLazySelect(se);
- se->MouseSelecting=1; se->CursorPreferBefore=se->CursorBefore; return 1;
- }else{
- if(!se->MouseSelecting) return 0;
- strSetCursor(se, (e->y-ui->U)/LA_RH+se->ViewStartLine, (real)se->ViewStartCol+((real)e->x-_L)/MonoWidth+0.5); strEndSelect(se);
- se->CursorPreferBefore=se->CursorBefore; return 1;
- }return 0;
- case LA_L_MOUSE_UP:
- se->MouseSelecting=0;
- }
- return 0;
- }
- int OPINV_UiItem(laOperator *a, laEvent *e){
- laUiItem *ui = a->Instance;
- a->CustomData = ui->Extra;
- return LA_RUNNING;
- }
- int OPINV_Tab(laOperator *a, laEvent *e){
- laUiList *uil;
- laUiItem *ui = a->Instance;
- laGeneralUiExtraData *uit;
- int count = 0;
- //if (e->Type == LA_L_MOUSE_DOWN) {
- //}
- a->CustomData = ui->Extra;
- uit = a->CustomData;
- uit->TargetIndexVali = count;
- return LA_RUNNING;
- }
- int OPEXT_UiItem(laOperator *a, int ExitCode){
- laUiItem *ui = a->Instance;
- return 0;
- }
- int OPMOD_IntArrayHorizon(laOperator *a, laEvent *e){
- laUiItem *ui = a->Instance;
- laBoxedTheme *bt = (*ui->Type->Theme);
- laGeneralUiExtraData *uit = a->CustomData;
- laIntProp *ip = ui->PP.LastPs->p;
- int Away = 0;
- int TmpArr[32];
- int Len = laGetArrayLength(&ui->PP);
- int IsVertical=(ui->Flags&LA_UI_FLAGS_TRANSPOSE)!=0;
- int NoEvent = ui->Flags&LA_UI_FLAGS_NO_EVENT;
- int NoTooltip=ui->Flags&LA_UI_FLAGS_NO_TOOLTIP;
- int IsKnob = ui->Flags&LA_UI_FLAGS_NODE_CONTAINER;
- if (!laIsInUiItem(ui, e->x, e->y) && !ui->Extra->On){
- ui->State = LA_UI_NORMAL;
- if (ui->Extra) ui->Extra->On = 0;
- laRedrawCurrentPanel();
- return LA_FINISHED_PASS;
- }
- if (e->type == LA_TIME_IDLE && !uit->On && !uit->Edit && !NoTooltip){
- int GX = e->x, GY = e->y; laLocalToWindow(a, a->ToPanel, &GX, &GY);
- laPanel *p = laEnableIdlePanel(a->ToPanel, a, 0, 0, &ui->PP, GX, GX + 150, GY, 600, 200, e);
- return LA_RUNNING;
- }
- if(NoEvent){ return LA_RUNNING_PASS; }
- if (e->type == LA_L_MOUSE_DOWN){
- if (laIsPropertyReadOnly(&ui->PP)) return LA_RUNNING_PASS;
- if (uit->Edit){
- if (!laIsInUiItem(ui, e->x, e->y)){
- strEndEdit(&uit->Edit, 1);
- uit->On = 0;
- laRedrawCurrentPanel();
- return LA_FINISHED;
- }
- if (strHasSelection(uit->Edit)) strDeselectAll(uit->Edit);
- else strSelectLineAll(uit->Edit);
- return LA_RUNNING;
- }
- uit->LastX = e->x;
- uit->LastY = e->y;
- ui->Extra->On = (IsVertical ? la_DetectRow(ui, e->y) : la_DetectColumn(ui, e->x, Len)) + 1;
- if (ui->Extra->On > Len) return LA_RUNNING;
- laGetIntArray(&ui->PP, &TmpArr);
- uit->TargetIndexValf = TmpArr[ui->Extra->On - 1];
- laRedrawCurrentPanel();
- return LA_RUNNING;
- }
- if (e->type == LA_MOUSEMOVE && ui->Extra->On){
- if(ui->Extra->Edit){ return LA_RUNNING; }
- int dist=abs(e->x - uit->LastX + uit->LastY - e->y);
- if (dist > MAIN.ValuatorThreshold || uit->Dragging){
- int min,max,Ranged = laGetIntRange(&ui->PP, &min, &max); real step=ip->Step; if(Ranged&&!IsKnob){ step=(real)(max-min)/(ui->R-ui->L); }
- if(Ranged){ TNS_CLAMP(step,(max-min)/500,INT_MAX); }
- //laGetIntArray(&ui->PP, &TmpArr);
- //uit->TargetIndexVali = TmpArr[ui->Extra->On - 1];
- int delta=e->x-uit->LastX; if(IsKnob){ int dy=uit->LastY-e->y; delta=delta+dy; } if(!uit->Dragging) delta=delta>0?1:-1;
- uit->TargetIndexValf += delta*step;
- laSetIntArraySingle(&ui->PP, ui->Extra->On - 1, uit->TargetIndexValf);
- uit->LastX = e->x;
- uit->LastY = e->y;
- uit->Dragging = 1;
- laRedrawCurrentPanel();
- }
- return LA_RUNNING;
- }
- if (e->type == LA_L_MOUSE_UP){
- if (laIsPropertyReadOnly(&ui->PP)) return LA_RUNNING_PASS;
- if (uit->Dragging){
- if (ui->Extra->On){
- ui->Extra->On = 0;
- laConfirmInt(a, uit->TargetIndexVali, LA_CONFIRM_DATA);
- laRecordAndPushProp(&ui->PP,0); laMarkPropChanged(&ui->PP);
- }
- }else if(ui->Extra->On){
- int SelectOn=(IsVertical ? la_DetectRow(ui, e->y) : la_DetectColumn(ui, e->x, Len)) + 1;
- if ((!uit->Edit) || (uit->Edit && (SelectOn != ui->Extra->On))){
- char buf[32] = {0};
- uit->On=SelectOn;
- laGetIntArray(&ui->PP, &TmpArr);
- uit->TargetIndexVali = TmpArr[ui->Extra->On - 1];
- strPrintIntAfter(buf, 32, uit->TargetIndexVali);
- strBeginEdit(&uit->Edit,buf);
- strSelectLineAll(uit->Edit);
- }
- }
- uit->Dragging = 0;
- laRedrawCurrentPanel();
- return LA_RUNNING;
- }
- if(e->type ==LA_KEY_DOWN){
- if (e->key == LA_KEY_ENTER && uit->Edit){
- char* buf=strEndEdit(&uit->Edit, 0);
- int Result; sscanf(buf, "%d", &Result); free(buf);
- laSetIntArraySingle(&ui->PP, ui->Extra->On - 1, Result);
- laRecordAndPushProp(&ui->PP,0); laMarkPropChanged(&ui->PP);
- ui->State = LA_UI_NORMAL;
- uit->Dragging = 0;
- uit->On = 0;
- laRedrawCurrentPanel();
- return LA_FINISHED_PASS;
- }
- }
-
- if (e->type == LA_R_MOUSE_DOWN){
- int GX = e->x, GY = e->y;
- ui->PP.LastIndex = la_DetectColumn(ui, e->x, Len);
- laLocalToWindow(a, a->ToPanel, &GX, &GY);
- laPanel *p = laEnablePropertyPanel(a->ToPanel, a, 0, 0, 0, &ui->PP, GX, GX + 150, GY, 600, 200, e);
- return LA_RUNNING;
- }
- if (uit->Edit){
- if (la_ProcessTextEdit(e, uit->Edit, ui)) laRedrawCurrentPanel();
- return LA_RUNNING;
- }
- return LA_RUNNING_PASS;
- }
- int OPMOD_FloatArrayHorizon(laOperator *a, laEvent *e){
- laUiItem *ui = a->Instance;
- laBoxedTheme *bt = (*ui->Type->Theme);
- laGeneralUiExtraData *uit = a->CustomData;
- laFloatProp *fp = ui->PP.LastPs->p;
- int Away = 0;
- real TmpArr[32];
- int Len = laGetArrayLength(&ui->PP);
- int IsVertical=(ui->Flags&LA_UI_FLAGS_TRANSPOSE)!=0;
- int NoEvent = ui->Flags&LA_UI_FLAGS_NO_EVENT;
- int IsRad=ui->PP.LastPs->p->IsRadAngle;
- int NoTooltip=ui->Flags&LA_UI_FLAGS_NO_TOOLTIP;
- int IsKnob = ui->Flags&LA_UI_FLAGS_NODE_CONTAINER;
- if (!laIsInUiItem(ui, e->x, e->y) && !ui->Extra->On && !NoTooltip){
- ui->State = LA_UI_NORMAL;
- ui->Extra->On = 0;
- laRedrawCurrentPanel();
- return LA_FINISHED_PASS;
- }
- if (e->type == LA_TIME_IDLE && !uit->On && !uit->Edit){
- int GX = e->x, GY = e->y; laLocalToWindow(a, a->ToPanel, &GX, &GY);
- laPanel *p = laEnableIdlePanel(a->ToPanel, a, 0, 0, &ui->PP, GX, GX + 150, GY, 600, 200, e);
- return LA_RUNNING;
- }
- if(NoEvent){ return LA_RUNNING_PASS; }
- if (e->type == LA_L_MOUSE_DOWN){
- if (uit->Edit){
- if (!laIsInUiItem(ui, e->x, e->y)){
- strEndEdit(&uit->Edit, 1);
- uit->On = 0;
- laRedrawCurrentPanel();
- return LA_FINISHED;
- }
- if (strHasSelection(uit->Edit)) strDeselectAll(uit->Edit);
- else strSelectLineAll(uit->Edit);
- return LA_RUNNING;
- }
- if (laIsPropertyReadOnly(&ui->PP)) return LA_RUNNING_PASS;
- uit->LastX = e->x;
- uit->LastY = e->y;
- ui->Extra->On = (IsVertical ? la_DetectRow(ui, e->y) : la_DetectColumn(ui, e->x, Len)) + 1;
- if (ui->Extra->On > Len) return LA_RUNNING;
- laGetFloatArray(&ui->PP, &TmpArr);
- uit->TargetIndexValf = TmpArr[ui->Extra->On - 1];
- laRedrawCurrentPanel();
- return LA_RUNNING;
- }
- if (e->type == LA_MOUSEMOVE && ui->Extra->On){
- if(uit->Edit){ return LA_RUNNING; }
- int dist=abs(e->x - uit->LastX - e->y + uit->LastY);
- if (dist > MAIN.ValuatorThreshold || uit->Dragging){
- real min,max; int Ranged = laGetFloatRange(&ui->PP, &min, &max); real step=fp->Step; if(Ranged&&!IsKnob){ step=(max-min)/(ui->R-ui->L); }
- if(Ranged){ TNS_CLAMP(step,(max-min)/500,INT_MAX); }
- laGetFloatArray(&ui->PP, &TmpArr);
- uit->TargetIndexValf = TmpArr[ui->Extra->On - 1];
- int delta=e->x-uit->LastX; if(IsKnob){ int dy=uit->LastY-e->y; delta=delta+dy; } if(!uit->Dragging) delta=delta>0?1:-1;
- uit->TargetIndexValf += delta*step;
- laSetFloatArraySingle(&ui->PP, ui->Extra->On - 1, uit->TargetIndexValf);
- uit->LastX = e->x;
- uit->LastY = e->y;
- uit->Dragging = 1;
- laRedrawCurrentPanel();
- }
- return LA_RUNNING;
- }
- if (e->type == LA_L_MOUSE_UP){
- if (laIsPropertyReadOnly(&ui->PP)) return LA_RUNNING_PASS;
- if (uit->Dragging){
- if (ui->Extra->On){
- ui->Extra->On = 0;
- laConfirmFloat(a, uit->TargetIndexValf, LA_CONFIRM_DATA);
- laRecordAndPushProp(&ui->PP,0); laMarkPropChanged(&ui->PP);
- }
- }else if(ui->Extra->On){
- int SelectOn=(IsVertical ? la_DetectRow(ui, e->y) : la_DetectColumn(ui, e->x, Len)) + 1;
- if ((!uit->Edit) || (uit->Edit && (SelectOn != ui->Extra->On))){
- char buf[32] = {0};
- uit->On=SelectOn;
- laGetFloatArray(&ui->PP, &TmpArr);
- uit->TargetIndexValf = TmpArr[ui->Extra->On - 1];
- strPrintFloatAfter(buf, 32, 5, IsRad?deg(uit->TargetIndexValf):uit->TargetIndexValf);
- strBeginEdit(&uit->Edit,buf);
- strSelectLineAll(uit->Edit);
- }
- }
- uit->Dragging = 0;
- laRedrawCurrentPanel();
- return LA_RUNNING;
- }
- if(e->type ==LA_KEY_DOWN){
- if (e->key == LA_KEY_ENTER && uit->Edit){
- char* buf=strEndEdit(&uit->Edit, 0);
- real Result; sscanf(buf, "%lf", &Result); free(buf);
- if(IsRad) Result=rad(Result);
- laSetFloatArraySingle(&ui->PP, ui->Extra->On - 1, Result);
- laRecordAndPushProp(&ui->PP,0); laMarkPropChanged(&ui->PP);
- uit->Dragging = 0;
- uit->On = 0;
- laRedrawCurrentPanel();
- return LA_FINISHED_PASS;
- }
- }
- if (e->type == LA_R_MOUSE_DOWN){
- int GX = e->x, GY = e->y;
- ui->PP.LastIndex = la_DetectColumn(ui, e->x, laGetArrayLength(&ui->PP));
- laLocalToWindow(a, a->ToPanel, &GX, &GY);
- laPanel *p = laEnablePropertyPanel(a->ToPanel, a, 0, 0, 0, &ui->PP, GX, GX + 150, GY, 600, 200, e);
- return LA_RUNNING;
- }
- if (uit->Edit){
- if (la_ProcessTextEdit(e, uit->Edit, ui)) laRedrawCurrentPanel();
- return LA_RUNNING;
- }
- return LA_RUNNING_PASS;
- }
- int OPMOD_FloatColor(laOperator *a, laEvent *e){
- laUiItem *ui = a->Instance;
- laBoxedTheme *bt = (*ui->Type->Theme);
- laGeneralUiExtraData *uit = a->CustomData;
- int Away = 0;
- int NoEvent = ui->Flags&LA_UI_FLAGS_NO_EVENT;
- int NoTooltip=ui->Flags&LA_UI_FLAGS_NO_TOOLTIP;
- if (!laIsInUiItem(ui, e->x, e->y)){
- return LA_FINISHED_PASS;
- }
- if (e->type == LA_TIME_IDLE && !NoTooltip){
- int GX = e->x, GY = e->y; laLocalToWindow(a, a->ToPanel, &GX, &GY);
- laPanel *p = laEnableIdlePanel(a->ToPanel, a, 0, 0, &ui->PP, GX, GX + 150, GY, 600, 200, e);
- return LA_RUNNING;
- }
-
- if(NoEvent){ return LA_RUNNING_PASS; }
- if (e->type == LA_L_MOUSE_DOWN){
- laUiList *uil;
- laColumn *col;
- laPanel *p;
- int GX = ui->L, GY = ui->B;
- ui->State = LA_UI_ACTIVE;
- laLocalToWindow(a, a->ToPanel, &GX, &GY);
- p = laEnableEmptyPropertyPanel(a->ToPanel, a, GX, GX + 150, GY, 500, e);{
- uil = &p->UI;
- col = laFirstColumn(uil);
- laShowItemFull(uil, col, &ui->PP, 0, LA_WIDGET_FLOAT_COLOR_HCY, 0, 0, 0);
- laShowItemFull(uil, col, &ui->PP, 0, LA_WIDGET_FLOAT, 0, 0, 0)->Flags=LA_UI_FLAGS_TRANSPOSE;
- laEnclosePanelContent(p, uil);
- }
- return LA_RUNNING;
- }
- if (e->type == LA_R_MOUSE_DOWN){
- int GX = e->x, GY = e->y;
- laLocalToWindow(a, a->ToPanel, &GX, &GY);
- laPanel *p = laEnablePropertyPanel(a->ToPanel, a, 0, 0, 0, &ui->PP, GX, GX + 150, GY, 600, 200, e);
- return LA_RUNNING;
- }
- return LA_RUNNING_PASS;
- }
- int OPMOD_ColorHCY(laOperator *a, laEvent *e){
- laUiItem *ui = a->Instance;
- laBoxedTheme *bt = (*ui->Type->Theme);
- laGeneralUiExtraData *es = a->CustomData;
- int Away = 0;
- int i = 0;
- real hcy[3] = {0};
- real Color[4] = {0};
- real PickerPos[2];
- real abso;
- if (!laIsInUiItem(ui, e->x, e->y) && !es->Dragging){
- return LA_FINISHED_PASS;
- }
- if(e->type == LA_L_MOUSE_DOWN && es->HeightCoeff>=0 && e->x>ui->R-bt->RM-LA_RH && e->y>ui->B-bt->BM-LA_RH){
- es->Dragging=3; es->LastX=e->x; es->LastY=e->y; es->TargetIndexVali=es->HeightCoeff; return LA_RUNNING;
- }
- if(es->Dragging==3){
- if(e->type==LA_MOUSEMOVE){ es->HeightCoeff=es->TargetIndexVali+((real)e->y-es->LastY+0.5)/LA_RH;
- if(es->HeightCoeff<1)es->HeightCoeff=1; laRecalcCurrentPanel();}
- elif(e->type==LA_L_MOUSE_UP){ es->Dragging=0; }
- elif(e->type==LA_R_MOUSE_DOWN){
- es->Dragging=0; es->HeightCoeff=es->TargetIndexVali; laRecalcCurrentPanel(); }
- return LA_RUNNING;
- }
- real c = (real)((ui->R + ui->L) / 2) - LA_RH / 2; /*- bt->RM;*/
- real r = (ui->B - ui->U - bt->TP - bt->BP) / 2;
- real dx = e->x - c, dy = e->y - (ui->U + r + bt->TP);
- real dist = sqrt(dx * dx + dy * dy);
- if (e->type == LA_L_MOUSE_DOWN){ ui->State = LA_UI_ACTIVE; laRedrawCurrentPanel(); es->Dragging=(dist<=r)?1:2; }
- if (e->type == LA_L_MOUSE_UP){
- ui->State = LA_UI_NORMAL; es->Dragging=0; laRedrawCurrentPanel();
- laRecordAndPushProp(&ui->PP,0); laMarkPropChanged(&ui->PP);
- return LA_RUNNING_PASS;
- }
- if (e->type & LA_MOUSE_EVENT && es->Dragging){
- laGetFloatArray(&ui->PP, Color);
- if(ui->PP.LastPs->p->Tag&LA_PROP_IS_LINEAR_SRGB){ tns2LogsRGB(Color); }
- tnsRGB2HCY(Color, hcy);
- if (es->Dragging==1){
- abso = fabs(atan((real)dy / (real)dx));
- hcy[0] = abso / TNS_PI / 2;
- if (dx > 0){
- if (dy < 0) hcy[0] = 1 - hcy[0];
- }else{
- if (dy > 0){
- hcy[0] = 0.5 - hcy[0];
- }else{
- hcy[0] += 0.5;
- }
- }
- hcy[1] = dist / r; TNS_CLAMP(hcy[1],0,1);
- hcy[1]=pow(hcy[1],MAIN.ColorPickerGamma);
- }else if (dist < r + LA_RH * 2 && dx > 0){
- abso = -atan((real)dy / (real)dx) / TNS_PI * 2 + 0.5;
- hcy[2] = abso; TNS_CLAMP(hcy[2],0,1);
- }
- tnsHCY2RGB(hcy, Color);
- if(ui->PP.LastPs->p->Tag&LA_PROP_IS_LINEAR_SRGB){ tns2LinearsRGB(Color); }
- laSetFloatArrayAllArray(&ui->PP, Color);
- laRedrawCurrentPanel();
- return LA_RUNNING;
- }
- return LA_RUNNING_PASS;
- }
- int OPMOD_EnumSelector(laOperator *a, laEvent *e){
- laUiItem *ui = a->Instance;
- laBoxedTheme *bt = (*ui->Type->Theme);
- laGeneralUiExtraData *uit = a->CustomData;
- laEnumItem *ei;
- laEnumProp *ep = ui->PP.LastPs->p;
- int at = 0;
- laEnumItem *Data[32];
- int NoEvent = ui->Flags&LA_UI_FLAGS_NO_EVENT;
- int NoTooltip=ui->Flags&LA_UI_FLAGS_NO_TOOLTIP;
- int IsCycle = ui->Flags&LA_UI_FLAGS_CYCLE;
- int IsMomentary = IsCycle && ui->Flags&LA_UI_FLAGS_NODE_CONTAINER;
- int NoConfirm = ui->Flags&LA_UI_FLAGS_NO_CONFIRM;
- // norm e1
- // expand e1 e2 e3
- // expand vertical (vertical)
- // arr expand e1 e1 e3
- // e2 e2 e3
- // arr exp+vert e1 e1
- // e2 e2
- // e3 e3
- if (a->ConfirmData /* && a->ConfirmData->Mode == LA_CONFIRM_DATA*/){
- ui->State = LA_UI_NORMAL;
- laRedrawCurrentPanel();
- return LA_RUNNING;
- }
- if (!laIsInUiItem(ui, e->x, e->y) && !uit->On){ return LA_FINISHED_PASS; }
-
- if (e->type == LA_TIME_IDLE && !NoTooltip && !uit->On){
- int GX = e->x, GY = e->y; laLocalToWindow(a, a->ToPanel, &GX, &GY);
- laPanel *p = laEnableIdlePanel(a->ToPanel, a, 0, 0, &ui->PP, GX, GX + 150, GY, 600, 200, e);
- return LA_RUNNING;
- }
- if(NoEvent){ return LA_RUNNING_PASS; }
- if (e->type == LA_L_MOUSE_DOWN || (IsMomentary && e->type == LA_L_MOUSE_UP)){
- if (laIsPropertyReadOnly(&ui->PP)) return LA_RUNNING_PASS;
- int IsVertical = ui->Flags&LA_UI_FLAGS_TRANSPOSE;
- int IsExpand = ui->Flags&LA_UI_FLAGS_EXPAND;
- int ArrLen = laGetArrayLength(&ui->PP);
- if(ArrLen==1){ if(!IsExpand) IsVertical=0; }else{ IsExpand=1; }
- int EnumLen = (IsExpand&&(!IsCycle)) ? laGetEnumEntryLen(&ui->PP) : 1;
- int _L,_R,_U,_B, _W=ui->R - ui->L, _Col=1;
- if(IsVertical){
- if(IsExpand){ _Col=ArrLen; }
- }else{
- if(IsExpand){ _Col=EnumLen; } else { _Col=ArrLen; }
- }
- int row = la_DetectRow(ui, e->y);
- int col = la_DetectColumn(ui, e->x, _Col);
- int ArrTarget=0, EnumTarget=0, ShowMenu=0;
- if(IsVertical){
- if(IsExpand){ EnumTarget=row; ArrTarget=col; } else { EnumTarget=col; }
- }else{
- if(IsExpand){ EnumTarget=col; ArrTarget=row; } else { if(!IsCycle) ShowMenu=1; }
- }
- if(ShowMenu){
- int GX = ui->L, GY = ui->B, GR = ui->R, t = 0;
- ui->State = LA_UI_ACTIVE;
- laLocalToWindow(a, a->ToPanel, &GX, &GY);
- laLocalToWindow(a, a->ToPanel, &GR, &t);
- laEnablePropertyPanel(a->ToPanel, a, 0, la_DefaultEnumPanel, 0, &ui->PP, GX, GR, GY, MAIN.CurrentWindow->CH-LA_2RH, 0, e);
- laRedrawCurrentPanel();
- }elif(IsCycle){
- laEnumItem* ei=laGetEnumArrayIndexed(&ui->PP, ArrTarget);
- if(!ei){ ei=((laEnumProp*)ui->PP.LastPs->p)->Items.pFirst; }
- ei = ei->Item.pNext?ei->Item.pNext:((laEnumProp*)ui->PP.LastPs->p)->Items.pFirst;
- if(IsMomentary){ uit->On = 1; if(e->type==LA_L_MOUSE_UP){ ei = ei=((laEnumProp*)ui->PP.LastPs->p)->Items.pFirst; uit->On = 0;} }
- laSetEnumArrayIndexed(&ui->PP, ArrTarget, ei->Index);
- if(!NoConfirm){ laConfirmInt(a,EnumTarget,LA_CONFIRM_DATA); }
- laRecordAndPushProp(&ui->PP,0); laMarkPropChanged(&ui->PP);
- if(ui->Flags&LA_UI_FLAGS_EXIT_WHEN_TRIGGERED) return LA_FINISHED;
- }else{
- if(ArrTarget>=ArrLen){ArrTarget=ArrLen-1;}
- if(EnumTarget>=EnumLen){EnumTarget=EnumLen-1;}
- laSetEnumArrayIndexedExternal(&ui->PP, ArrTarget, EnumTarget);
- if(!NoConfirm){ laConfirmInt(a,EnumTarget,LA_CONFIRM_DATA); }
- laRecordAndPushProp(&ui->PP,0); laMarkPropChanged(&ui->PP);
- return LA_RUNNING_PASS;
- }
- return LA_RUNNING;
- }
- if(e->type==LA_R_MOUSE_DOWN){
- int GX = e->x, GY = e->y;
- laLocalToWindow(a, a->ToPanel, &GX, &GY);
- laPanel *p = laEnablePropertyPanel(a->ToPanel, a, 0, 0, 0, &ui->PP, GX, GX + 150, GY, 600, 200, e);
- return LA_RUNNING;
- }
- return LA_RUNNING_PASS;
- }
- int OPMOD_Button(laOperator *a, laEvent *e){
- laUiItem *ui = a->Instance;
- laBoxedTheme *bt = (*ui->Type->Theme);
- int lx, ly;
- int Away = 0;
- if (e->type == LA_TIME_IDLE && !ui->State){
- int GX = e->x, GY = e->y; laLocalToWindow(a, a->ToPanel, &GX, &GY);
- laPanel *p = laEnableIdlePanel(a->ToPanel, a, &ui->ExtraPP, 0, &ui->PP, GX, GX + 150, GY, 600, 200, e);
- return LA_RUNNING;
- }
-
- if (laConfirmSameDataIfAny(a)) return LA_RUNNING_PASS;
- if (e->type == LA_ESCAPE_DOWN || e->type == LA_INPUT) return LA_FINISHED; //debug
- if (!laIsInUiItem(ui, e->x, e->y) /*&& ui->State!= LA_UI_ACTIVE*/){
- ui->State = LA_UI_NORMAL;
- laRedrawCurrentPanel();
- return LA_FINISHED_PASS;
- }
- if (e->type == LA_L_MOUSE_DOWN){
- ui->State = LA_UI_ACTIVE;
- laRedrawCurrentPanel();
- return LA_RUNNING;
- }
- char *str;
- int call_ret=0;
- if (e->type == LA_L_MOUSE_UP && ui->State!=LA_UI_NORMAL){
- ui->State = LA_UI_NORMAL;
- if (ui->AT){
- if (!ui->Instructions){
- if (ui->ExtraInstructions) strMakeInstructions(&ui->Instructions, ui->ExtraInstructions->Ptr);
- if (ui->AT->ExtraInstructions) strMakeInstructions(&ui->Instructions, ui->AT->ExtraInstructions);
- }
- if (!laOperatorAvailableP(ui->AT, 0, ui->Instructions)) return LA_RUNNING;
- lx = e->x;
- ly = e->y;
- laLocalToWindow(a, a->ToPanel, &e->x, &e->y);
- e->Localized = 0;
- call_ret=laInvokeP(0, ui->AT, e, 0, ui->ExtraInstructions ? ui->ExtraInstructions->Ptr : 0, 0);
- e->x = lx;
- e->y = ly;
- e->Localized = 1;
- }else{
- laOperatorProp *ap = ui->PP.LastPs->p;
- if (ap->OperatorID){
- if (!ap->OperatorType) ap->OperatorType = laGetOperatorType(ap->OperatorID);
- if (!ui->Instructions){
- if (ui->ExtraInstructions) strMakeInstructions(&ui->Instructions, ui->ExtraInstructions->Ptr);
- if (ap->OperatorType) strMakeInstructions(&ui->Instructions, ap->OperatorType->ExtraInstructions);
- }
- if (!laOperatorAvailablePSafe(ap->OperatorType, ui->PP.RawThis, ui->PP.Go->UseInstance, ui->Instructions)) return LA_RUNNING;
- lx = e->x;
- ly = e->y;
- laLocalToWindow(a, a->ToPanel, &e->x, &e->y);
- e->Localized = 0;
- call_ret=laInvokePCreateThis(0, ap->OperatorType, e, ui->PP.RawThis, ui->PP.Go->UseInstance, ui->ExtraInstructions ? ui->ExtraInstructions->Ptr : 0, ap->Base.ExtraInstructions);
- if(a->StopNow) return LA_FINISHED;
- laRetriggerOperators();
- e->x = lx;
- e->y = ly;
- e->Localized = 1;
- }
- }
- if(MAIN.InvokeConfirmData){
- a->ConfirmData=MAIN.InvokeConfirmData; laConfirmSameDataIfAny(a); a->ConfirmData=0;
- }else{
- if (str = strGetArgumentString(ui->Instructions, "feedback")){
- if (strSame(str, "CONFIRM")) laConfirmInt(a, 0, LA_CONFIRM_OK);
- elif (strSame(str, "CANCEL")) laConfirmInt(a, 0, LA_CONFIRM_CANCEL);
- else { laConfirmString(a, str, LA_CONFIRM_CUSTOM_STRING); }
- }elif(!(ui->Flags&LA_UI_FLAGS_NO_CONFIRM)){
- laConfirmInt(a, 0, LA_CONFIRM_OK);
- }
- }
- if(call_ret==LA_OPERATOR_CALLS_SHUTOFF) return LA_OPERATOR_CALLS_SHUTOFF;
- laRedrawCurrentPanel();
- if(ui->Flags&LA_UI_FLAGS_EXIT_WHEN_TRIGGERED) return LA_FINISHED_PASS;
- return LA_RUNNING_PASS;
- }
- return LA_RUNNING_PASS;
- }
- int OPMOD_MenuItem(laOperator *a, laEvent *e){
- laUiItem *ui = a->Instance;
- laPanel *p;
- laBoxedTheme *bt = (*ui->Type->Theme);
- laGeneralUiExtraData *uit = a->CustomData;
- int Away = 0;
- if (a->ConfirmData){
- ui->State = LA_UI_NORMAL;
- laConfirmInt(a, a->ConfirmData->IData, a->ConfirmData->Mode);
- laRedrawCurrentPanel();
- return LA_RUNNING_PASS;
- }
- if (!laIsInUiItem(ui, e->x, e->y) && ui->State != LA_UI_ACTIVE){
- ui->State = LA_UI_NORMAL;
- laRedrawCurrentPanel();
- return LA_FINISHED_PASS;
- }
- if (e->type == LA_L_MOUSE_DOWN){
- int GX = ui->L, GY = ui->B;
- laLocalToWindow(a, a->ToPanel, &GX, &GY);
- ui->State = LA_UI_ACTIVE;
- p = laEnableMenuPanel(a->ToPanel, a, ui->Subs.pFirst, &ui->PP, GX, GX + 300, GY, MAIN.CurrentWindow->CH-LA_2RH, 0, e);
- laShowPanelWithDropDownEffect(p);
- laRedrawCurrentPanel();
- return LA_RUNNING;
- }
- return LA_RUNNING_PASS;
- }
- int OPMOD_ConditionToggle(laOperator *a, laEvent *e){
- laUiItem *ui = a->Instance;
- laBoxedTheme *bt = (*ui->Type->Theme);
- laGeneralUiExtraData *uit = a->CustomData;
- int Away = 0;
- if (!laIsInUiItem(ui, e->x, e->y) /*&& ui->State!= LA_UI_ACTIVE*/){
- return LA_FINISHED_PASS;
- }
- if (e->type == LA_L_MOUSE_DOWN){
- ui->State = ui->State == LA_UI_ACTIVE ? LA_UI_NORMAL : LA_UI_ACTIVE;
- laRecalcCurrentPanel();
- return LA_RUNNING;
- }
- return LA_RUNNING_PASS;
- }
- int OPMOD_SingleLineString(laOperator *a, laEvent *e){
- laUiItem *ui = a->Instance;
- laBoxedTheme *bt = (*ui->Type->Theme);
- laGeneralUiExtraData *uit = a->CustomData;
- laStringEdit *se = uit->Edit;
- int Away = 0;
- char _buf[LA_RAW_CSTR_MAX_LEN] = {0}; char* buf=_buf;
- int NoEvent = ui->Flags&LA_UI_FLAGS_NO_EVENT;
- int NoTooltip=ui->Flags&LA_UI_FLAGS_NO_TOOLTIP;
- int IsTerminal=ui->Flags&LA_UI_FLAGS_TERMINAL_INPUT;
- int ImmediateInput=ui->Flags&LA_UI_FLAGS_IMMEDIATE_INPUT;
- if (!laIsInUiItem(ui, e->x, e->y)){
- if (ui->State != LA_UI_EDITING){
- ui->State = LA_UI_NORMAL;
- laRedrawCurrentPanel();
- return LA_FINISHED_PASS;
- }else{
- if(IsTerminal && (e->type&LA_KEY_MOUSE_SCROLL)){ return LA_RUNNING_PASS; }
- if ((e->type & LA_MOUSEDOWN) == LA_MOUSEDOWN){
- buf=strEndEdit(&uit->Edit, 0);
- laSetString(&ui->PP, buf); free(buf);
- laRecordAndPushProp(&ui->PP,0); laMarkPropChanged(&ui->PP);
- ui->State = LA_UI_NORMAL;
- laRedrawCurrentPanel();
- return LA_FINISHED_PASS;
- }
- }
- }
- if (e->type == LA_TIME_IDLE && !ui->State && !NoTooltip){
- int GX = e->x, GY = e->y; laLocalToWindow(a, a->ToPanel, &GX, &GY);
- laPanel *p = laEnableIdlePanel(a->ToPanel, a, 0, 0, &ui->PP, GX, GX + 150, GY, 600, 200, e);
- return LA_RUNNING;
- }
-
- if(NoEvent){ return LA_RUNNING_PASS; }
- if(e->type ==LA_KEY_DOWN){
- if (e->key == LA_KEY_ENTER){
- buf=IsTerminal?strGetEditString(uit->Edit,0):strEndEdit(&uit->Edit, 0);
- if(IsTerminal){ MAIN.IsTerminalEnter=1; }
- laSetString(&ui->PP, buf); free(buf);
- laRedrawCurrentPanel();
- if(!IsTerminal){
- laRecordAndPushProp(&ui->PP,0); laMarkPropChanged(&ui->PP);
- ui->State = LA_UI_NORMAL;
- return LA_FINISHED_PASS;
- }else{
- laGetString(&ui->PP, _buf, &buf);
- strBeginEdit(&uit->Edit,buf);
- MAIN.IsTerminalEnter=0;
- return LA_RUNNING;
- }
- }else if (e->key == LA_KEY_ESCAPE && ui->State != LA_UI_NORMAL){
- ui->State = LA_UI_NORMAL;
- laRedrawCurrentPanel();
- return LA_FINISHED;
- }
- }
- if(laKeyMapExecuteEventEx(a, &ui->ExtraPP, &ui->Type->KeyMapper, e)) return LA_RUNNING;
- if (e->type == LA_L_MOUSE_DOWN){
- if (ui->State == LA_UI_NORMAL){
- if(laIsPropertyReadOnly(&ui->PP)) return LA_RUNNING;
- ui->State = LA_UI_EDITING;
- laGetString(&ui->PP, _buf, &buf);
- strBeginEdit(&uit->Edit,buf);
- strSelectLineAll(uit->Edit);
- }elif (ui->State == LA_UI_EDITING){
- if (strHasSelection(uit->Edit)) strDeselectAll(uit->Edit);
- else strSelectLineAll(uit->Edit);
- }
- laRedrawCurrentPanel();
- return LA_RUNNING;
- }
- if (e->type == LA_R_MOUSE_DOWN){
- int GX = e->x, GY = e->y;
- ui->PP.LastIndex = la_DetectColumn(ui, e->x, laGetArrayLength(&ui->PP));
- laLocalToWindow(a, a->ToPanel, &GX, &GY);
- laPanel *p = laEnablePropertyPanel(a->ToPanel, a, ui->State==LA_UI_EDITING?&ui->ExtraPP:0, 0, 0, &ui->PP, GX, GX + 150, GY, 600, 200, e);
- return LA_RUNNING;
- }
- if (ui->State == LA_UI_EDITING){
- if (la_ProcessTextEdit(e, se, ui)){
- laRedrawCurrentPanel();
- if(ImmediateInput){
- buf=strGetEditString(uit->Edit,0); laSetString(&ui->PP, buf); free(buf);
- }
- }
- return LA_RUNNING;
- }
- if (ui->State != LA_UI_EDITING) return LA_RUNNING_PASS;
- else return LA_RUNNING;
- }
- void la_SetMultistringViewRange(laUiItem* ui, laStringEdit* se, laBoxedTheme* bt){
- int NumberWidth=0; int MonoWidth=tnsGetMonoFontAdvance(); int Count=se->TotalLines;
- while(Count){ Count/=10; NumberWidth+=MonoWidth; }
- strSetEditViewRange(ui->Extra->Edit,
- ui->Extra->HeightCoeff>0?ui->Extra->HeightCoeff:((ui->B-ui->U)/LA_RH),(ui->R-ui->L-NumberWidth-bt->LM*2-bt->RM)/MonoWidth);
- }
- int OPMOD_MultiString(laOperator *a, laEvent *e){
- laUiItem *ui = a->Instance;
- laBoxedTheme *bt = (*ui->Type->Theme);
- laGeneralUiExtraData *es = a->CustomData;
- laStringEdit *se = es->Edit;
- int Away = 0;
- char _buf[LA_RAW_CSTR_MAX_LEN] = {0}; char* buf=&_buf;
- int NoEvent = ui->Flags&LA_UI_FLAGS_NO_EVENT;
- int NoTooltip=ui->Flags&LA_UI_FLAGS_NO_TOOLTIP;
- if (!laIsInUiItem(ui, e->x, e->y) && !es->Dragging){
- if ((e->type & LA_MOUSEDOWN) == LA_MOUSEDOWN){
- buf=strGetEditString(es->Edit, 0); laSetString(&ui->PP, buf); free(buf);
- laRecordAndPushProp(&ui->PP,0); laMarkPropChanged(&ui->PP);
- ui->State = LA_UI_NORMAL;
- laRedrawCurrentPanel();
- return LA_FINISHED_PASS;
- }
- if(ui->State!=LA_UI_ACTIVE) return LA_FINISHED_PASS;
- }
- if (e->type == LA_TIME_IDLE && ui->State!=LA_UI_ACTIVE && !NoTooltip){
- int GX = e->x, GY = e->y; laLocalToWindow(a, a->ToPanel, &GX, &GY);
- laPanel *p = laEnableIdlePanel(a->ToPanel, a, 0, 0, &ui->PP, GX, GX + 150, GY, 600, 200, e);
- return LA_RUNNING;
- }
- if(NoEvent){ return LA_RUNNING_PASS; }
- if(e->type ==LA_KEY_DOWN){
- if (e->key == LA_KEY_ESCAPE){
- if(ui->State != LA_UI_NORMAL){
- buf=strGetEditString(es->Edit, 0); laSetString(&ui->PP, buf); free(buf);
- laRecordAndPushProp(&ui->PP,0); laMarkPropChanged(&ui->PP);
- ui->State = LA_UI_NORMAL; laRedrawCurrentPanel();la_SetMultistringViewRange(ui,es->Edit,bt);
- }
- if(es->Dragging){ es->Dragging=0; es->HeightCoeff=es->TargetIndexVali; laRecalcCurrentPanel();la_SetMultistringViewRange(ui,es->Edit,bt); }
- return LA_FINISHED;
- }
- }
- if(laKeyMapExecuteEventEx(a, &ui->ExtraPP, &ui->Type->KeyMapper, e)) return LA_RUNNING;
-
- if(e->type == LA_L_MOUSE_DOWN && es->HeightCoeff>=0 && e->x>ui->R-bt->RM-LA_RH && e->y>ui->B-bt->BM-LA_RH){
- es->Dragging=1; es->LastX=e->x; es->LastY=e->y; es->TargetIndexVali=es->HeightCoeff;
- return LA_RUNNING;
- }
- if(es->Dragging){
- if(e->type==LA_MOUSEMOVE){ es->HeightCoeff=es->TargetIndexVali+((real)e->y-es->LastY+0.5)/LA_RH;
- if(es->HeightCoeff<1)es->HeightCoeff=1; laRecalcCurrentPanel(); la_SetMultistringViewRange(ui,es->Edit,bt);}
- elif(e->type==LA_L_MOUSE_UP){ es->Dragging=0; }
- elif(e->type==LA_R_MOUSE_DOWN){
- es->Dragging=0; es->HeightCoeff=es->TargetIndexVali; laRecalcCurrentPanel();la_SetMultistringViewRange(ui,se,bt); }
- return LA_RUNNING;
- }
-
- int NoInactiveScroll=ui->Flags&LA_UI_FLAGS_NO_SCROLL_INACTIVE;
- if((!NoInactiveScroll) || (ui->State==LA_UI_ACTIVE)){
- if(e->type==LA_MOUSE_WHEEL_DOWN){ strMoveView(se, MAIN.ScrollingSpeed, 0); laRedrawCurrentPanel(); return LA_RUNNING; }
- elif(e->type==LA_MOUSE_WHEEL_UP){ strMoveView(se, -MAIN.ScrollingSpeed, 0); laRedrawCurrentPanel(); return LA_RUNNING; }
- }
- if (e->type == LA_L_MOUSE_DOWN){
- if (ui->State == LA_UI_NORMAL){
- ui->State = LA_UI_ACTIVE;
- laGetString(&ui->PP, _buf, &buf);
- strBeginEdit(&es->Edit,buf);la_SetMultistringViewRange(ui,es->Edit,bt);
- laRedrawCurrentPanel();
- return LA_RUNNING;
- }
- }
- if (e->type == LA_R_MOUSE_DOWN){
- int GX = e->x, GY = e->y;
- ui->PP.LastIndex = la_DetectColumn(ui, e->x, laGetArrayLength(&ui->PP));
- laLocalToWindow(a, a->ToPanel, &GX, &GY);
- laPanel *p = laEnablePropertyPanel(a->ToPanel, a, ui->State==LA_UI_ACTIVE?&ui->ExtraPP:0, 0, 0, &ui->PP, GX, GX + 150, GY, 600, 200, e);
- return LA_RUNNING;
- }
- if (ui->State == LA_UI_ACTIVE){
- if (la_ProcessTextEdit(e, se, ui))laRedrawCurrentPanel();
- return LA_RUNNING;
- }
- if (ui->State != LA_UI_ACTIVE) return LA_RUNNING_PASS;
- else return LA_RUNNING;
- }
- int OPMOD_TabSelector(laOperator *a, laEvent *e){
- laUiItem *ui = a->Instance;
- laBoxedTheme *bt = (*ui->Type->Theme);
- laGeneralUiExtraData *uit = a->CustomData;
- laUiList *uil;
- int Away = 0;
- int count = 0;
- int it = 0;
- int page;
- if (!laIsInBound(e->x, e->y, ui->L, ui->R, ui->U, ui->U+LA_RH)){ return LA_FINISHED; }
- if (e->type == LA_L_MOUSE_DOWN){
- if (ui->Page->HeightCoeff && ui->R - e->x < LA_RH + bt->RM) return LA_RUNNING_PASS;
- for (uil = ui->Subs.pFirst; uil; uil = uil->Item.pNext){ count++; }
- page = la_DetectColumn(ui, e->x, count);
- for (uil = ui->Subs.pFirst; uil; uil = uil->Item.pNext){
- if (it == page){
- laRecalcCurrentPanel();
- ui->Page = uil;
- return LA_RUNNING;
- }else
- it++;
- }
- }
-
- return LA_RUNNING_PASS;
- }
- int OPMOD_Collection(laOperator *a, laEvent *e) {
- laUiItem *ui = a->Instance;
- laGeneralUiExtraData *uit = a->CustomData;
- laListHandle Locals = {0};
- laUiList *uil;
- int lx = e->x, ly = e->y;
- int at = 0;
- laUiList *ToUil =
- a->ToPanel->MenuRefer ? a->ToPanel->MenuRefer : &a->ToPanel->UI;
- if (!laIsInUiItem(ui, e->x, e->y) /* || e->y>(ui->Subs.pFirst?((laUiList*)ui->Subs.pFirst)->HeightCoeff:10000)*/){
- return LA_FINISHED_PASS;
- }
- laLocalToPanel(a, &lx, &ly);
- if (a->ToPanel && ui->U>=a->ToPanel->TitleBar.B && ly < a->ToPanel->TitleBar.B) {
- return LA_FINISHED_PASS;
- }
- uil = la_DetectUiListRecursive(ToUil, lx, ly, 10000, 0, 0, 0, 0, 0);
- if (uil != ((laUiListDrawItem *)a->LocalUiLists.pFirst)->Target) {
- //printf("%d %d EXITC\n",((laUiListDrawItem *)a->LocalUiLists.pFirst)->Target, uil);
- return LA_FINISHED;
- }
- if (e->type & LA_MOUSE_EVENT) {
- laUiList *sub;
- laUiItem *tui;
- int LimHeight = 10000;
- int UIB = ui->B, UIU = ui->U;
- int t = 0;
- void *Active = ui->PP.EndInstance;
- if (ui->Subs.pFirst)
- LimHeight = (int)((laUiList *)ui->Subs.pFirst)->HeightCoeff;
- if (LimHeight > 0)
- UIB = LimHeight;
- laPanelToLocal(a, &t, &UIB);
- for (sub = ui->Subs.pFirst; sub; sub = sub->Item.pNext) {
- ui->PP.EndInstance = sub->Instance;
- if ((tui = la_DetectUiItemRecursive(sub, e->x, e->y, UIB, &Locals, 0))) {
- if (tui && !a->Child && tui->Type->OperatorType) {
- // printf("invui %d\n", tui);
- laSetOperatorLocalizer(a->ToPanel);
- laInvokeUiP(a, tui->Type->OperatorType, e, tui, &Locals, 0);
- }
- }
- lstClearPointer(&Locals);
- }
- ui->PP.EndInstance = Active;
- }
- if (e->type == LA_L_MOUSE_DOWN && (!laIsPropertyReadOnly(&ui->PP)) &&
- ui->Type != _LA_UI_COLLECTION_SINGLE) {
- laUiList *uil;
- for (uil = ui->Subs.pFirst; uil; uil = uil->Item.pNext) {
- if (a->ConfirmData)
- return LA_RUNNING_PASS;
- if (laIsInBound(e->x, e->y, uil->L, uil->R, uil->U, uil->B)) {
- laRecalcCurrentPanel();
- laPropPack PP = {0};
- la_CopyPropPack(
- &ui->PP,
- &PP); // needed because layout can be switched after set active.
- char *cmd;
- if ((!(cmd = strGetArgumentString(ui->Instructions, "feedback"))) ||
- (!strSame(cmd, "NONE"))) {
- laConfirmPointer(a, uil->Instance, la_EnsureSubTarget(ui->PP.LastPs->p, uil->Instance), LA_CONFIRM_DATA);
- }
- laSetActiveInstance(ui->PP.LastPs->p, ui->PP.LastPs->UseInstance,
- uil->Instance);
- laRecordAndPushProp(&PP, 0);
- laMarkPropChanged(&PP);
- return LA_RUNNING_PASS;
- }
- }
- return LA_RUNNING;
- }
- elif (e->type == LA_R_MOUSE_DOWN) {
- laUiList *uil;
- for (uil = ui->Subs.pFirst; uil; uil = uil->Item.pNext) {
- if (laIsInBound(e->x, e->y, uil->L, uil->R, uil->U, uil->B)) {
- ui->PP.EndInstance = uil->Instance;
- lx = e->x, ly = e->y;
- laLocalToWindow(a, a->ToPanel, &lx, &ly);
- laEnablePropertyPanel(a->ToPanel, a, 0, 0, laui_PropOperatorUiDefine, &ui->PP,
- lx, lx, ly, 0, 0, e);
- }
- }
- return LA_RUNNING;
- }
- return LA_RUNNING_PASS;
- }
- int OPMOD_CollectionSelector(laOperator *a, laEvent *e){
- laUiItem *ui = a->Instance;
- laBoxedTheme *bt = (*ui->Type->Theme);
- laGeneralUiExtraData *uit = a->CustomData;
- int NoTooltip=ui->Flags&LA_UI_FLAGS_NO_TOOLTIP;
- int at = 0;
- int ReadOnly=laIsPropertyReadOnly(&ui->PP);
- int Simple=ui->Flags&LA_UI_COLLECTION_SIMPLE_SELECTOR;
- if (a->ConfirmData /* && a->ConfirmData->Mode == LA_CONFIRM_DATA*/){
- ui->State = LA_UI_NORMAL;
- laRecalcCurrentPanel();
- return LA_RUNNING;
- }
- if (!laIsInUiItem(ui, e->x, e->y)){
- return LA_FINISHED;
- }
- int lx = e->x, ly = e->y;
- laUiList *ToUil =
- a->ToPanel->MenuRefer ? a->ToPanel->MenuRefer : &a->ToPanel->UI;
- laUiList* uil = la_DetectUiListRecursive(ToUil, lx, ly, 10000, 0, 0, 0, 0, 0);
- if (uil != ((laUiListDrawItem *)a->LocalUiLists.pFirst)->Target) {
- //printf("%d %d EXIT\n",((laUiListDrawItem *)a->LocalUiLists.pFirst)->Target, uil);
- return LA_FINISHED;
- }
- if (e->type == LA_TIME_IDLE && !ui->State && !NoTooltip){
- int GX = e->x, GY = e->y; laLocalToWindow(a, a->ToPanel, &GX, &GY);
- laPanel *p = laEnableIdlePanel(a->ToPanel, a, 0, 0, &ui->PP, GX, GX + 150, GY, 600, 200, e);
- return LA_RUNNING;
- }
- if (e->type == LA_L_MOUSE_DOWN){
- laUiList *uil;
- laColumn *col;
- laPanel *p;
- int GX = ui->L, GY = ui->B, GR = ui->R, t = 0;
- if(ReadOnly){ return LA_FINISHED; }
- if(!Simple){
- if (e->x >= TNS_MAX2(ui->R - LA_RH,(ui->R+ui->L)/2) && e->x < ui->R){
- laSetActiveInstance(ui->PP.LastPs->p, ui->PP.LastPs->UseInstance, 0);
- laRecordAndPushProp(&ui->PP,0); laMarkPropChanged(&ui->PP);
- return LA_FINISHED;
- }
- }
- laLocalToWindow(a, a->ToPanel, &GX, &GY);
- laLocalToWindow(a, a->ToPanel, &GR, &t);
- laRedrawCurrentPanel();
- ui->State = LA_UI_ACTIVE;
- p = laEnableEmptyPropertyPanel(a->ToPanel, a, GX, GR, GY, 500, e);{
- int MinWidth;
- uil = &p->UI;
- col = laFirstColumn(uil);
- laShowItemFull(uil, col, &ui->PP, 0, LA_WIDGET_COLLECTION, 0, ui->Template, 0)->SymbolID = ui->SymbolID;
- laEnclosePanelContent(p, &p->UI);
- }
- return LA_RUNNING;
- }
- return LA_RUNNING_PASS;
- }
- int OPMOD_ColumnAdjuster(laOperator *a, laEvent *e){
- laUiItem *ui = a->Instance;
- laBoxedTheme *bt = (*ui->Type->Theme);
- laGeneralUiExtraData *uit = a->CustomData;
- laColumn *c = uit->Ptr1;
- c = uit->Ptr1 ? uit->Ptr1 : la_DetectSplit(ui->C, e->x);
- if(c){ laSetWindowCursor(LA_LEFT_AND_RIGHT); }else{ laSetWindowCursor(LA_ARROW); }
- if ((!uit->Dragging) && (!laIsInUiItem(ui, e->x, e->y)||!c)){
- //printf("done\n");
- laSetWindowCursor(LA_ARROW);
- return LA_FINISHED_PASS;
- }
- if (e->type == LA_L_MOUSE_DOWN){
- uit->Ptr1 = c;
- uit->LastX = e->x;
- uit->Dragging=1;
- return LA_RUNNING;
- }
- if (uit->Dragging && uit->Ptr1 && e->type == LA_MOUSEMOVE){
- la_AdjustColumnSplit(c, e->x - uit->LastX);
- uit->LastX = e->x;
- laRecalcCurrentPanel();
- return LA_RUNNING;
- }
- if (uit->Dragging && (e->type == LA_L_MOUSE_UP || e->type == LA_R_MOUSE_DOWN || e->key == LA_KEY_ESCAPE)){
- uit->Ptr1 = 0; uit->Dragging=0;
- return LA_RUNNING;
- }
- return LA_RUNNING;
- }
- void la_NodeSocketGetPositionDelta(laUiItem* ui, int ex,int ey,int* dx,int* dy){
- int cx,cy;
- if(ui->Flags&LA_UI_SOCKET_LABEL_E){ cy=(ui->U+ui->B)/2; cx=ui->L+(ui->B-ui->U)/2; }
- elif(ui->Flags&LA_UI_SOCKET_LABEL_W){ cy=(ui->U+ui->B)/2; cx=ui->R-(ui->B-ui->U)/2; }
- elif(ui->Flags&LA_UI_SOCKET_LABEL_N){ cx=(ui->L+ui->R)/2; cy=ui->U+(ui->R-ui->L)*0.75; }
- elif(ui->Flags&LA_UI_SOCKET_LABEL_S){ cx=(ui->L+ui->R)/2; cy=ui->B-(ui->R-ui->L)*0.75; }
- else{ cx=(ui->L+ui->R)/2; cy=(ui->U+ui->B)/2; }
- *dx=cx-ex; *dy=cy-ey;
- }
- int OPMOD_NodeSocket(laOperator *a, laEvent *e){
- laUiItem *ui = a->Instance;
- laBoxedTheme *bt = (*ui->Type->Theme);
- laGeneralUiExtraData *uit = a->CustomData;
- int lx=e->x,ly=e->y;
- laProp* p=ui->PP.LastPs->p; laPropContainer* pc=la_EnsureSubTarget(p,0);
- laPropContainer* PCFind;
- if(pc==LA_PC_SOCKET_IN) { PCFind=LA_PC_SOCKET_OUT; }
- elif(pc==LA_PC_SOCKET_OUT){ PCFind=LA_PC_SOCKET_IN; }
- if ((!uit->Dragging) && (!laIsInUiItem(ui, e->x, e->y))){ return LA_FINISHED_PASS; }
- if (e->type==LA_TIME_IDLE){ return LA_RUNNING_PASS; }
- if (e->type == LA_L_MOUSE_DOWN){
- uit->Dragging=1; MAIN.NextWireColor+=3;
- if(pc==LA_PC_SOCKET_IN) {
- laNodeInSocket* s=ui->PP.EndInstance;
- uit->Ptr2 = s->Source;
- if(!s->Source){
- s->ColorId=MAIN.NextWireColor; s->Source=MAIN.tNodeOut; latouched_NodeInSocket(0,0);
- MAIN.tNodeOut->RuntimeX=MAIN.tNodeOut->RuntimeY=MAIN.tNodeOut->RuntimePX=MAIN.tNodeOut->RuntimePY=0;
- }else{
- MAIN.tNodeIn->Source = s->Source;
- MAIN.tNodeIn->RuntimeX=MAIN.tNodeIn->RuntimeY=MAIN.tNodeIn->RuntimePX=MAIN.tNodeIn->RuntimePY=0;
- MAIN.tNodeIn->RuntimePX=-(s->Source->RuntimeX+s->Source->RuntimePX)+(s->RuntimeX+s->RuntimePX);
- MAIN.tNodeIn->RuntimePY=-(s->Source->RuntimeY+s->Source->RuntimePY)+(s->RuntimeY+s->RuntimePY);
- s->Source=0; MAIN.tNodeIn->ColorId=s->ColorId; latouched_NodeInSocket(0,0);
- }
- }
- elif(pc==LA_PC_SOCKET_OUT){ MAIN.tNodeIn->Source=ui->PP.EndInstance; latouched_NodeInSocket(0,0);
- MAIN.tNodeIn->RuntimeX=MAIN.tNodeIn->RuntimeY=MAIN.tNodeIn->RuntimePX=MAIN.tNodeIn->RuntimePY=0;
- MAIN.tNodeIn->ColorId=MAIN.NextWireColor; }
- int dx,dy; la_NodeSocketGetPositionDelta(ui,e->x,e->y,&dx,&dy); uit->LastX = e->x+dx; uit->LastY = e->y+dy;
- laRedrawCurrentPanel();
- return LA_RUNNING;
- }
- if (uit->Dragging && e->type == LA_MOUSEMOVE){
- laPanel* p=MAIN.CurrentPanel;
- laLocalToPanel(a, &lx, &ly);
- laUiItem* tui=la_DetectSocketRecursive(&p->UI,lx,ly,100000,uit->Ptr2?LA_PC_SOCKET_IN:PCFind); uit->Ptr1=tui;
- if(pc==LA_PC_SOCKET_IN){
- if(!uit->Ptr2){MAIN.tNodeOut->RuntimeX=e->x-uit->LastX;MAIN.tNodeOut->RuntimeY=e->y-uit->LastY;}
- else { MAIN.tNodeIn->RuntimeX=e->x-uit->LastX;MAIN.tNodeIn->RuntimeY=e->y-uit->LastY; } }
- elif(pc==LA_PC_SOCKET_OUT){ MAIN.tNodeIn->RuntimeX=e->x-uit->LastX; MAIN.tNodeIn->RuntimeY=e->y-uit->LastY; }
- laRedrawCurrentPanel();
- return LA_RUNNING;
- }
- if (uit->Dragging && (e->type == LA_L_MOUSE_UP || e->type == LA_R_MOUSE_DOWN || e->key == LA_KEY_ESCAPE)){
- uit->Dragging=0; MAIN.tNodeIn->Source=0;
- laRecalcCurrentPanel();
- laUiItem* tui=uit->Ptr1; void* soc=tui?tui->PP.EndInstance:0;
- if(pc == LA_PC_SOCKET_IN){
- if(!uit->Ptr2){ if(!tui){ laNodeInSocket* s=ui->PP.EndInstance; s->Source=0; return LA_RUNNING; }
- laNodeInSocket* s=ui->PP.EndInstance; s->Source=0; memAssignRef(s,&s->Source,soc); latouched_NodeInSocket(0,0);
- s->ColorId=MAIN.NextWireColor; laRecordAndPushProp(&ui->PP, 0); laMarkPropChanged(&ui->PP);
- }else{
- if(!tui){
- laNodeInSocket* s=ui->PP.EndInstance; s->Source=uit->Ptr2; memAssignRef(s,&s->Source,0); latouched_NodeInSocket(0,0);
- laRecordAndPushProp(&ui->PP, 0); laMarkPropChanged(&ui->PP);
- }else{
- laNodeInSocket* s=soc; if(s->Source){ uit->Ptr2=0; return LA_RUNNING; } latouched_NodeInSocket(0,0);
- memAssignRef(s,&s->Source,uit->Ptr2); s->ColorId=((laNodeInSocket*)ui->PP.EndInstance)->ColorId;
- laRecordDifferences(&ui->PP,0); laRecordDifferences(&tui->PP,0); laPushDifferences("Socket status changed", 0);
- laMarkPropChanged(&tui->PP); laMarkPropChanged(&ui->PP);
- }
- }
- }
- else{
- if(!tui){ return LA_RUNNING; }
- laNodeInSocket* s=soc; s->Source=0; memAssignRef(s,&s->Source,ui->PP.EndInstance); latouched_NodeInSocket(0,0);
- s->ColorId=MAIN.NextWireColor; laRecordAndPushProp(&tui->PP, 0); laMarkPropChanged(&tui->PP);
- }
-
- uit->Ptr2=0;
- return LA_RUNNING;
- }
- return LA_RUNNING_PASS;
- }
- int OPMOD_HeightAdjuster(laOperator *a, laEvent *e){
- laUiItem *ui = a->Instance;
- laBoxedTheme *bt = (*ui->Type->Theme);
- laGeneralUiExtraData *uit = a->CustomData;
- int lx=e->x,ly=e->y;
- int ClickedVal=0;
- if ((!uit->Dragging) && (!laIsInUiItem(ui, e->x, e->y))){ return LA_FINISHED_PASS; }
- if (e->type == LA_L_MOUSE_DOWN || e->type==LA_R_MOUSE_DOWN){
- uit->Dragging=1; uit->LastY=e->y; uit->On=0; uit->TargetIndexVali=e->type==LA_L_MOUSE_DOWN?(ui->State==LA_BT_ACTIVE?2:1):2; uit->HeightCoeff=1;
- return LA_RUNNING;
- }
- if(e->type==LA_L_MOUSE_UP && uit->HeightCoeff){ ui->State=(ui->State==LA_BT_ACTIVE)?LA_BT_NORMAL:LA_BT_ACTIVE; laRedrawCurrentPanel(); }
- if (uit->Dragging && e->type == LA_MOUSEMOVE){
- int diff=e->y-uit->LastY; diff=((real)diff+0.5)/(ui->B-ui->U); int delta=uit->TargetIndexVali;
- if(diff!=uit->On){ uit->HeightCoeff=0; int d=diff-uit->On; uit->On=diff; while(d){ laSetInt(&ui->PP, d>0?delta:-delta); d-=(d>0?1:-1); }; laRecalcCurrentPanel(); }
- return LA_RUNNING;
- }
- if (uit->Dragging && (e->type == LA_L_MOUSE_UP || e->type == LA_R_MOUSE_UP || e->key == LA_KEY_ESCAPE)){
- uit->Dragging=0; return LA_RUNNING_PASS;
- }
- return LA_RUNNING_PASS;
- }
- void la_ValueMapperSortPoint(laValueMapper* vm){
- laValueMapperPoint* vmp,*ivmp; laListHandle temp={0}; int Inserted=0;
- while(vmp=lstPopItem(&vm->Points)){
- Inserted=0;
- for(ivmp=temp.pLast;ivmp;ivmp=ivmp->Item.pPrev){
- if(ivmp->x<vmp->x){ lstInsertItemAfter(&temp,vmp,ivmp); Inserted=1; break; }
- }
- if(!Inserted){ lstPushItem(&temp,vmp); }
- }
- vm->Points.pFirst=temp.pFirst; vm->Points.pLast=temp.pLast;
- }
- laValueMapperPoint* la_ValueMapperCreatePoint(laValueMapper* vm, real x, real y){
- laValueMapperPoint* vmp=memAcquire(sizeof(laValueMapperPoint));
- vmp->x=x;vmp->y=y; lstAppendItem(&vm->Points,vmp);
- la_ValueMapperSortPoint(vm);
- return vmp;
- }
- laValueMapperPoint* la_ValueMapperGetPoint(laValueMapper* vm, real x, real y){
- laValueMapperPoint* vmp=0,*ClosestVMP=0; real MinD=FLT_MAX;
- if(x<0||x>1||y>1||y<0) return 0;
- const real thres=0.1;
- for(vmp=vm->Points.pFirst;vmp;vmp=vmp->Item.pNext){
- if(vmp->x>x+thres || vmp->x<x-thres || vmp->y>y+thres || vmp->y<y-thres) continue;
- real d=tnsDistIdv2(x,y,vmp->x,vmp->y);
- if(d<MinD){ ClosestVMP=vmp; MinD=d; }
- }
- vmp=ClosestVMP;
- if(!vmp){ vmp=la_ValueMapperCreatePoint(vm,x,y); }
- return vmp;
- }
- void la_ValueMapperEnsureValidPoints(laValueMapper* vm){
- if(!vm->Points.pFirst){ la_ValueMapperCreatePoint(vm,0,0); }
- if(vm->Points.pFirst==vm->Points.pLast){ la_ValueMapperCreatePoint(vm,1,1); }
- }
- laValueMapper* laValueMapperInit(){
- laValueMapper* vm=memAcquire(sizeof(laValueMapper));
- vm->InRange[0]=0; vm->InRange[1]=1; vm->OutRange[0]=0; vm->OutRange[1]=1;
- la_ValueMapperEnsureValidPoints(vm);
- return vm;
- }
- laValueMapper* laValueMapperDestroy(laValueMapper* vm){
- laValueMapperPoint* vmp;
- while(vmp=lstPopItem(&vm->Points)){ memLeave(vmp); }
- memLeave(vm);
- }
- laValueMapper* laValueMapperCopy(laValueMapper* new_optional, laValueMapper* vm){
- laValueMapper* into=new_optional?new_optional:memAcquire(sizeof(laValueMapper)); laValueMapperPoint* vmp;
- while(vmp=lstPopItem(&into->Points)){ memLeave(vmp); }
- for(vmp=vm->Points.pFirst;vmp;vmp=vmp->Item.pNext){ la_ValueMapperCreatePoint(into, vmp->x, vmp->y); }
- tnsVectorSet2v(into->InRange,vm->InRange); tnsVectorSet2v(into->OutRange,vm->OutRange);
- return into;
- }
- real laValueMapperEvaluate(laValueMapper* vm, real x, real* force_InMin, real* force_InMax, real* force_OutMin, real* force_OutMax, int ClampIn, int ClampOut){
- real InMin=vm->InRange[0], InMax=vm->InRange[1], OutMin=vm->OutRange[0], OutMax=vm->OutRange[1];
- if(force_InMin) InMin=*force_InMin; if(force_InMax) InMax=*force_InMax; if(force_OutMin) OutMin=*force_OutMin; if(force_OutMax) OutMax=*force_OutMax;
- if(fabs(InMax-InMin)<1e-7) return 0;
- x=tnsGetRatiod(InMin,InMax,x); if(ClampIn) TNS_CLAMP(x,0,1);
- laValueMapperPoint* vmp,*NextVMP;
- real ey=0;
- for(vmp=vm->Points.pFirst;vmp;vmp=vmp->Item.pNext){
- NextVMP=vmp->Item.pNext;
- if(NextVMP && (!(vmp->x<=x && NextVMP->x>x))) continue;
- if(!NextVMP){ NextVMP=vmp; vmp=vmp->Item.pPrev; if(!vmp) return 0; }
- if(fabs(vmp->x-NextVMP->x)<1e-7){ ey=vmp->y; break; }
- real ratio=tnsGetRatiod(vmp->x,NextVMP->x,x);
- ey=tnsInterpolate(vmp->y,NextVMP->y,ratio); break;
- }
- real Out=tnsInterpolate(OutMin,OutMax,ey);
- if(ClampOut) TNS_CLAMP(Out,OutMin,OutMax);
- return Out;
- }
- int OPMOD_ValueMapper(laOperator *a, laEvent *e){
- laUiItem *ui = a->Instance;
- laBoxedTheme *bt = (*ui->Type->Theme);
- laGeneralUiExtraData *uit = a->CustomData;
- int w=ui->R-ui->L, h=ui->B-ui->U;
- real x=(real)(e->x-ui->L)/w,y=(real)(ui->B-e->y)/h;
- int ClickedVal=0;
- if ((!uit->Dragging) && (!laIsInUiItem(ui, e->x, e->y))){ return LA_FINISHED_PASS; }
- laValueMapper* vm=ui->PP.EndInstance;
- if (e->type == LA_L_MOUSE_DOWN){
- uit->Dragging=1; uit->LastX=e->x; uit->LastY=e->y;
- return LA_RUNNING;
- }
- if (uit->Dragging && e->type == LA_MOUSEMOVE){
- laValueMapperPoint* vmp=uit->Ptr1;
- if(uit->Dragging==1 && tnsDistIdv2(e->x,e->y,uit->LastX,uit->LastY)>LA_RH/2){
- uit->Ptr1=la_ValueMapperGetPoint(vm,x,y); if(!uit->Ptr1){ uit->Dragging=0; return LA_RUNNING; }
- uit->Dragging=2;
- }
- elif(uit->Dragging==2){
- if(x<0&&x>-0.05){ x=0; } if(x>1&&x<1.05){ x=1; } TNS_CLAMP(y,0,1);
- vmp->x=x; vmp->y=y; la_ValueMapperSortPoint(vm);
- laNotifyUsersPP(&ui->PP); laRedrawCurrentPanel(); laMarkPropChanged(&ui->PP);
- }
- return LA_RUNNING;
- }
- if (uit->Dragging && (e->type == LA_L_MOUSE_UP || e->type == LA_R_MOUSE_UP || e->key == LA_KEY_ESCAPE)){
- uit->Dragging=0; laValueMapperPoint* vmp=uit->Ptr1; if(!vmp) return LA_RUNNING_PASS;
- if(vmp->x>1||vmp->x<0) {
- lstRemoveItem(&vm->Points,vmp); la_ValueMapperEnsureValidPoints(vm);
- laNotifyUsersPP(&ui->PP); laRedrawCurrentPanel(); laRecordAndPushProp(&ui->PP,0); laMarkPropChanged(&ui->PP);
- }
- return LA_RUNNING_PASS;
- }
- return LA_RUNNING_PASS;
- }
- void la_RegisterUiOperatorsBasic(){
- laPropContainer *pc, *p;
- laOperatorType *at;
- laEnumProp *ep;
- laCreateOperatorType("LA_edit_string_copy", "Copy Selection", "Copy selected string to clip board",
- OPCHK_EditStringCopySelection, 0, 0, OPINV_EditStringCopySelection, 0, U'🗍', LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
- laCreateOperatorType("LA_int_array_h_operator", "Int(Horizon) UiItem Operator", "Do Array Valuator Stuff",
- 0, 0, OPEXT_UiItem, OPINV_UiItem, OPMOD_IntArrayHorizon, U'🖦', LA_EXTRA_TO_PANEL | LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
- laCreateOperatorType("LA_real_array_h_operator", "Float(Horizon) UiItem Operator", "Do Array Valuator Stuff",
- 0, 0, OPEXT_UiItem, OPINV_UiItem, OPMOD_FloatArrayHorizon, U'🖦', LA_EXTRA_TO_PANEL | LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
- laCreateOperatorType("LA_real_color_operator", "Color(Float) Display UiItem Operator", "Color Display,Click To Set Color",
- 0, 0, OPEXT_UiItem, OPINV_UiItem, OPMOD_FloatColor, U'🖦', LA_EXTRA_TO_PANEL | LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
- laCreateOperatorType("LA_real_hcy_operator", "HCY Color Picker UiItem Operator", "HCY Color Picker,Click To Set Color",
- 0, 0, OPEXT_UiItem, OPINV_UiItem, OPMOD_ColorHCY, U'🖦', LA_EXTRA_TO_PANEL | LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
- laCreateOperatorType("LA_enum_selector_operator", "Enum Selector UiItem Operator", "Do Selector Stuff",
- 0, 0, OPEXT_UiItem, OPINV_UiItem, OPMOD_EnumSelector, U'🖦', LA_EXTRA_TO_PANEL | LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
- laCreateOperatorType("LA_button_operator", "Button UiItem Operator", "Execute an Operator",
- 0, 0, OPEXT_UiItem, OPINV_UiItem, OPMOD_Button, U'🖦', LA_EXTRA_TO_PANEL | LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
- laCreateOperatorType("LA_menu_root_operator", "Menu Root UiItem Operator", "Drop A Menu",
- 0, 0, OPEXT_UiItem, OPINV_UiItem, OPMOD_MenuItem, U'🖦', LA_EXTRA_TO_PANEL | LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
- laCreateOperatorType("LA_condition_toggle_operator", "Condition +/- Button Operator", "Do Self Condition Function",
- 0, 0, OPEXT_UiItem, OPINV_UiItem, OPMOD_ConditionToggle, U'🖦', LA_EXTRA_TO_PANEL | LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
- laCreateOperatorType("LA_string_operator", "Single Line String Operator", "Do String Modifying Function",
- 0, 0, OPEXT_UiItem, OPINV_UiItem, OPMOD_SingleLineString, U'🖦', LA_EXTRA_TO_PANEL | LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
- laCreateOperatorType("LA_string_multi", "Multi Line String Operator", "Do String Modifying Function",
- 0, 0, OPEXT_UiItem, OPINV_UiItem, OPMOD_MultiString, U'🖦', LA_EXTRA_TO_PANEL | LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
- laCreateOperatorType("LA_tab_operator", "Tab Switcher Operator", "Change The Page In The Tab Group",
- 0, 0, OPEXT_UiItem, OPINV_Tab, OPMOD_TabSelector, U'🖦', LA_EXTRA_TO_PANEL | LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
- laCreateOperatorType("LA_collection_operator", "Collection UiItem Operator", "Activate/Deactivate Collection Item(s)",
- 0, 0, OPEXT_UiItem, OPINV_UiItem, OPMOD_Collection, U'🖦', LA_EXTRA_TO_PANEL | LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
- laCreateOperatorType("LA_collection_selector_operator", "Collection Dropdown Selector Operator", "Do Selector Stuff",
- 0, 0, OPEXT_UiItem, OPINV_UiItem, OPMOD_CollectionSelector, U'🖦', LA_EXTRA_TO_PANEL | LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
- laCreateOperatorType("LA_column_adjuster", "Column Width Adjuster", "Drag To Set Width of Columns",
- 0, 0, OPEXT_UiItem, OPINV_UiItem, OPMOD_ColumnAdjuster, U'🖦', LA_EXTRA_TO_PANEL | LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
- laCreateOperatorType("LA_node_socket", "Node Socket Operator", "Drag to connect node sockets",
- 0, 0, OPEXT_UiItem, OPINV_UiItem, OPMOD_NodeSocket, U'🖦', LA_EXTRA_TO_PANEL | LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
- laCreateOperatorType("LA_height_adjuster", "Height Adjuster Operator", "Drag to adjust heights of an instance",
- 0, 0, OPEXT_UiItem, OPINV_UiItem, OPMOD_HeightAdjuster, U'🖦', LA_EXTRA_TO_PANEL | LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
- laCreateOperatorType("LA_value_mapper", "Value mapper Operator", "Drag to set value mapping from input to output",
- 0, 0, OPEXT_UiItem, OPINV_UiItem, OPMOD_ValueMapper, U'🖦', LA_EXTRA_TO_PANEL | LA_ACTUATOR_SYSTEM | LA_ACTUATOR_HIDDEN);
- }
|