TempleOSCD_140715.ISO
This commit is contained in:
1 parent
7ef616a20e
commit
64f679eeb9
1095 files changed
+24814
-221011
No files matched your search
@@ -4,5 +4,3 @@
|
||||
#include "Ctrls2a"
|
||||
#include "CtrlsButton"
|
||||
#include "CtrlsSlider"
|
||||
|
||||
#help_index ""
|
||||
+17
-21
@@ -1,5 +1,5 @@
|
||||
public CCtrl *CtrlFindUnique(CTask *haystack_task,I64 needle_type)
|
||||
{
|
||||
{//Find task ctrl givin $LK,"ctrl_type",A="MN:CTRLT_VIEWING_ANGLES"$.
|
||||
CCtrl *c;
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
c=haystack_task->next_ctrl;
|
||||
@@ -23,15 +23,15 @@ U0 CtrlsUpdate(CTask *task)
|
||||
if (c->update_derived_vals)
|
||||
(*c->update_derived_vals)(c);
|
||||
if (c->flags&CTRLF_BORDER) {
|
||||
c->screen_left =gr_pan_text_x+task->pix_left+c->left-FONT_WIDTH;
|
||||
c->screen_right =gr_pan_text_x+task->pix_left+c->right-FONT_WIDTH;
|
||||
c->screen_top =gr_pan_text_y+task->pix_top+c->top-FONT_HEIGHT;
|
||||
c->screen_bottom=gr_pan_text_y+task->pix_top+c->bottom-FONT_HEIGHT;
|
||||
c->screen_left =gr.pan_text_x+task->pix_left+c->left-FONT_WIDTH;
|
||||
c->screen_right =gr.pan_text_x+task->pix_left+c->right-FONT_WIDTH;
|
||||
c->screen_top =gr.pan_text_y+task->pix_top+c->top-FONT_HEIGHT;
|
||||
c->screen_bottom=gr.pan_text_y+task->pix_top+c->bottom-FONT_HEIGHT;
|
||||
} else {
|
||||
c->screen_left =gr_pan_text_x+task->pix_left+c->left;
|
||||
c->screen_right =gr_pan_text_x+task->pix_left+c->right;
|
||||
c->screen_top =gr_pan_text_y+task->pix_top+c->top;
|
||||
c->screen_bottom=gr_pan_text_y+task->pix_top+c->bottom;
|
||||
c->screen_left =gr.pan_text_x+task->pix_left+c->left;
|
||||
c->screen_right =gr.pan_text_x+task->pix_left+c->right;
|
||||
c->screen_top =gr.pan_text_y+task->pix_top+c->top;
|
||||
c->screen_bottom=gr.pan_text_y+task->pix_top+c->bottom;
|
||||
}
|
||||
c=c->next;
|
||||
}
|
||||
@@ -40,7 +40,6 @@ U0 CtrlsUpdate(CTask *task)
|
||||
|
||||
fp_update_ctrls=&CtrlsUpdate;
|
||||
|
||||
|
||||
Bool CtrlInsideRect(CCtrl *c,I64 x,I64 y)
|
||||
{//screen coordinates
|
||||
if (c->screen_left<=x<=c->screen_right &&
|
||||
@@ -51,7 +50,7 @@ Bool CtrlInsideRect(CCtrl *c,I64 x,I64 y)
|
||||
}
|
||||
|
||||
public Bool CtrlInside(CCtrl *c,I64 x,I64 y)
|
||||
{
|
||||
{//Is x,y inside a ctrl?
|
||||
if (c->flags&CTRLF_SHOW) {
|
||||
if (c->inside_ctrl)
|
||||
return (*c->inside_ctrl)(c,x,y);
|
||||
@@ -64,7 +63,7 @@ public Bool CtrlInside(CCtrl *c,I64 x,I64 y)
|
||||
U0 DrawCtrls(CTask *task)
|
||||
{
|
||||
CCtrl *c;
|
||||
CDC *dc=DCAlias(gr_dc2,task);
|
||||
CDC *dc=DCAlias(gr.dc2,task);
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
c=task->next_ctrl;
|
||||
while (c!=&task->next_ctrl) {
|
||||
@@ -112,7 +111,6 @@ U0 DrawCtrls(CTask *task)
|
||||
DCDel(dc);
|
||||
}
|
||||
|
||||
|
||||
#define WIN_SCROLL_SIZE 8
|
||||
#define WIN_SCROLL_BORDER_BONUS 4
|
||||
U0 DrawWinScroll(CDC *dc,CCtrl *c)
|
||||
@@ -147,15 +145,15 @@ U0 WinDerivedScrollValsUpdate(CCtrl *c)
|
||||
if (!range) range=1;
|
||||
switch (c->type) {
|
||||
case CTRLT_WIN_HSCROLL:
|
||||
c->left =gr_pan_text_x+FONT_WIDTH-WIN_SCROLL_BORDER_BONUS+(s->pos-s->min)*(c->win_task->pix_width+2*WIN_SCROLL_BORDER_BONUS-WIN_SCROLL_SIZE)/range;
|
||||
c->left =gr.pan_text_x+FONT_WIDTH-WIN_SCROLL_BORDER_BONUS+(s->pos-s->min)*(c->win_task->pix_width+2*WIN_SCROLL_BORDER_BONUS-WIN_SCROLL_SIZE)/range;
|
||||
c->right =c->left+WIN_SCROLL_SIZE-1;
|
||||
c->top =gr_pan_text_y+FONT_HEIGHT+(FONT_WIDTH-WIN_SCROLL_SIZE)/2+c->win_task->pix_height;
|
||||
c->top =gr.pan_text_y+FONT_HEIGHT+(FONT_WIDTH-WIN_SCROLL_SIZE)/2+c->win_task->pix_height;
|
||||
c->bottom=c->top+WIN_SCROLL_SIZE-1;
|
||||
break;
|
||||
case CTRLT_WIN_VSCROLL:
|
||||
c->left =gr_pan_text_x+FONT_WIDTH+(FONT_WIDTH-WIN_SCROLL_SIZE)/2+c->win_task->pix_width;
|
||||
c->left =gr.pan_text_x+FONT_WIDTH+(FONT_WIDTH-WIN_SCROLL_SIZE)/2+c->win_task->pix_width;
|
||||
c->right =c->left+WIN_SCROLL_SIZE-1;
|
||||
c->top =gr_pan_text_y+FONT_HEIGHT-WIN_SCROLL_BORDER_BONUS+(s->pos-s->min)*(c->win_task->pix_height+2*WIN_SCROLL_BORDER_BONUS-WIN_SCROLL_SIZE)/range;
|
||||
c->top =gr.pan_text_y+FONT_HEIGHT-WIN_SCROLL_BORDER_BONUS+(s->pos-s->min)*(c->win_task->pix_height+2*WIN_SCROLL_BORDER_BONUS-WIN_SCROLL_SIZE)/range;
|
||||
c->bottom=c->top+WIN_SCROLL_SIZE-1;
|
||||
break;
|
||||
}
|
||||
@@ -280,7 +278,6 @@ U0 DrawViewAnglesCtrl(CDC *dc,CCtrl *c)
|
||||
dc->color=s->cx^8;
|
||||
GrRect(dc,i-2,j-1,5,3);
|
||||
|
||||
|
||||
dc->color=s->cy;
|
||||
GrPrint(dc,c->left+2*VIEWANGLES_SPACING+1-FONT_WIDTH/2,
|
||||
c->top+VIEWANGLES_SPACING-(1+FONT_HEIGHT),"Y");
|
||||
@@ -297,7 +294,6 @@ U0 DrawViewAnglesCtrl(CDC *dc,CCtrl *c)
|
||||
dc->color=s->cy^8;
|
||||
GrRect(dc,i-2,j-1,5,3);
|
||||
|
||||
|
||||
dc->color=s->cz;
|
||||
GrPrint(dc,c->left+3*VIEWANGLES_SPACING+2-FONT_WIDTH/2,
|
||||
c->top+VIEWANGLES_SPACING-(1+FONT_HEIGHT),"Z");
|
||||
@@ -350,7 +346,7 @@ U0 LeftClickViewAngles(CCtrl *c,I64 x,I64 y,Bool)
|
||||
}
|
||||
|
||||
public CCtrl *ViewAnglesNew(CTask *task=NULL)
|
||||
{
|
||||
{//Create view angle ctrl. See $LK,"::/Demo/Graphics/Shading.CPP.Z"$.
|
||||
Bool old_preempt;
|
||||
CCtrl *c;
|
||||
CViewAngles *s;
|
||||
@@ -380,7 +376,7 @@ public CCtrl *ViewAnglesNew(CTask *task=NULL)
|
||||
}
|
||||
|
||||
public U0 ViewAnglesDel(CTask *task=NULL)
|
||||
{
|
||||
{//Free view angle ctrl.
|
||||
CCtrl *c;
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
if (!task) task=Fs;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#define BUTTON_BORDER 2
|
||||
#define BUTTBORDER 2
|
||||
|
||||
#define BTF_DONT_FREE 1
|
||||
|
||||
@@ -21,8 +21,8 @@ U0 DrawCtrlButton(CDC *dc,CCtrl *c)
|
||||
st=s->state_texts;
|
||||
dc->color=s->state_colors[s->state];
|
||||
l=StrLen(st);
|
||||
GrRect(dc,c->left+BUTTON_BORDER,c->top+BUTTON_BORDER,
|
||||
c->right-c->left+1-BUTTON_BORDER*2,c->bottom-c->top+1-BUTTON_BORDER*2);
|
||||
GrRect(dc,c->left+BUTTBORDER,c->top+BUTTBORDER,
|
||||
c->right-c->left+1-BUTTBORDER*2,c->bottom-c->top+1-BUTTBORDER*2);
|
||||
dc->color=s->state_colors[s->state]^(WHITE<<16+WHITE);
|
||||
GrPrint(dc,(c->left+c->right+1-l*FONT_WIDTH)>>1,
|
||||
(c->top+c->bottom+1-FONT_HEIGHT)>>1,"%s",st);
|
||||
@@ -40,7 +40,7 @@ U0 LeftClickCtrlButton(CCtrl *c,I64,I64,Bool down)
|
||||
|
||||
public CCtrl *CtrlButtonNew(I64 x,I64 y,I64 width=-1,I64 height=-1,
|
||||
I64 num_states=1,U8 *state_texts,I32 state_colors[],CCtrlButtonState *_s=NULL)
|
||||
{
|
||||
{//Create button ctrl. See $LK,"::/Apps/Strut/Strut.CPP.Z"$.
|
||||
Bool old_preempt;
|
||||
CCtrl *result;
|
||||
CCtrlButtonState *s;
|
||||
@@ -53,9 +53,9 @@ public CCtrl *CtrlButtonNew(I64 x,I64 y,I64 width=-1,I64 height=-1,
|
||||
j=StrLen(st);
|
||||
if (j>l) l=j;
|
||||
}
|
||||
width=BUTTON_BORDER*4+l*FONT_WIDTH;
|
||||
width=BUTTBORDER*4+l*FONT_WIDTH;
|
||||
}
|
||||
if (height<0) height=BUTTON_BORDER*4+FONT_HEIGHT;
|
||||
if (height<0) height=BUTTBORDER*4+FONT_HEIGHT;
|
||||
result=CAlloc(sizeof(CCtrl));
|
||||
if (_s) {
|
||||
s=_s;
|
||||
@@ -84,7 +84,7 @@ public CCtrl *CtrlButtonNew(I64 x,I64 y,I64 width=-1,I64 height=-1,
|
||||
}
|
||||
|
||||
public U0 CtrlButtonDel(CCtrl *c)
|
||||
{
|
||||
{//Free button ctrl.
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
QueRem(c);
|
||||
Preempt(old_preempt);
|
||||
|
||||
+18
-21
@@ -1,40 +1,39 @@
|
||||
class CMgdSCSlider
|
||||
class CTemplateSCSlider
|
||||
{
|
||||
CMgdSCSlider *next,*last;
|
||||
CTemplateSCSlider *next,*last;
|
||||
U8 *name;
|
||||
I64 num;
|
||||
};
|
||||
|
||||
class CMgdSC
|
||||
class CTemplateSC
|
||||
{
|
||||
CMgdSCSlider *next_slider,*last_slider;
|
||||
CTemplateSCSlider *next_slider,*last_slider;
|
||||
I64 num_sliders,range,spacing,border;
|
||||
U8 *glbl_name;
|
||||
};
|
||||
|
||||
|
||||
CMgdSC *PmtSliderCtrl()
|
||||
CTemplateSC *GetSliderCtrl()
|
||||
{
|
||||
CMgdSCSlider *temps;
|
||||
CTemplateSCSlider *temps;
|
||||
U8 *st,pmt[136];
|
||||
CMgdSC *result=CAlloc(sizeof(CMgdSC));
|
||||
CTemplateSC *result=CAlloc(sizeof(CTemplateSC));
|
||||
|
||||
"$$PURPLE$$Slider Ctrl$$FG$$\n\n";
|
||||
|
||||
result->glbl_name=PmtStr("Glbl Struct Name (ENTER for No Glbl):");
|
||||
result->range=PmtI64 ("Range (%4d):",30);
|
||||
result->spacing=PmtI64("Spacing (%4d):",20);
|
||||
result->border=PmtI64 ("Border (%4d):",2);
|
||||
result->glbl_name=GetStr("Glbl Struct Name (ENTER for No Glbl):");
|
||||
result->range=GetI64 ("Range (%4d):",30);
|
||||
result->spacing=GetI64("Spacing (%4d):",20);
|
||||
result->border=GetI64 ("Border (%4d):",2);
|
||||
|
||||
result->next_slider=result->last_slider=&result->next_slider;
|
||||
while (TRUE) {
|
||||
SPrint(pmt,"Slider #%d Name:",result->num_sliders+1);
|
||||
st=PmtStr(pmt);
|
||||
StrPrint(pmt,"Slider #%d Name:",result->num_sliders+1);
|
||||
st=GetStr(pmt);
|
||||
if (!*st) {
|
||||
Free(st);
|
||||
break;
|
||||
}
|
||||
temps=CAlloc(sizeof(CMgdSCSlider));
|
||||
temps=CAlloc(sizeof(CTemplateSCSlider));
|
||||
temps->name=st;
|
||||
QueIns(temps,result->last_slider);
|
||||
temps->num=result->num_sliders++;
|
||||
@@ -42,18 +41,18 @@ CMgdSC *PmtSliderCtrl()
|
||||
return result;
|
||||
}
|
||||
|
||||
U0 MgdSliderCtrl(CDoc *doc)
|
||||
U0 TemplateSliderCtrl(CDoc *doc)
|
||||
{
|
||||
CTask *task;
|
||||
CMgdSC *m=NULL;
|
||||
CMgdSCSlider *temps;
|
||||
CTemplateSC *m=NULL;
|
||||
CTemplateSCSlider *temps;
|
||||
I64 i;
|
||||
|
||||
DocUnlock(doc);
|
||||
DocRecalc(doc);
|
||||
DocCaptureUndo(doc,TRUE);
|
||||
|
||||
task=SpawnUser("CMgdSC **_m=0x%X;*_m=PmtSliderCtrl;\n",&m);
|
||||
task=SpawnUser("CTemplateSC **_m=0x%X;*_m=GetSliderCtrl;\n",&m);
|
||||
while (!m)
|
||||
Yield;
|
||||
|
||||
@@ -66,7 +65,6 @@ class CSliderState
|
||||
{
|
||||
",m->range,m->spacing,m->border);
|
||||
|
||||
|
||||
temps=m->next_slider;
|
||||
while (temps!=&m->next_slider) {
|
||||
DocPrint(doc," I64 %s;\n",temps->name);
|
||||
@@ -77,7 +75,6 @@ class CSliderState
|
||||
else
|
||||
DocPrint(doc,"};\n");
|
||||
|
||||
|
||||
DocPrint(doc,
|
||||
"
|
||||
U0 DrawSliderCtrl(CDC *dc,CCtrl *c)
|
||||
|
||||
Reference in new issue
Block a user