TempleOSCD_150720.ISO

This commit is contained in:
Terry A. Davis authored and minexew committed 2018-09-08 21:46:22 +02:00
1 parent 401601816c
commit f8c05f98f4
554 files changed
+26046 -24853

No files matched your search

+49 -33
View File
@@ -1,7 +1,7 @@
public CCtrl *CtrlFindUnique(CTask *haystack_task,I64 needle_type)
{//Find task ctrl givin $LK,"ctrl_type",A="MN:CTRLT_VIEWING_ANGLES"$.
{//Find task ctrl given $LK,"ctrl_type",A="MN:CTRLT_VIEWING_ANGLES"$.
CCtrl *c;
Bool old_preempt=Preempt(OFF);
Bool old_preempt=Preempt;
c=haystack_task->next_ctrl;
while (c!=&haystack_task->next_ctrl) {
if (c->type==needle_type) {
@@ -17,7 +17,7 @@ public CCtrl *CtrlFindUnique(CTask *haystack_task,I64 needle_type)
U0 CtrlsUpdate(CTask *task)
{
CCtrl *c;
Bool old_preempt=Preempt(OFF);
Bool old_preempt=Preempt;
c=task->next_ctrl;
while (c!=&task->next_ctrl) {
if (c->update_derived_vals)
@@ -43,7 +43,7 @@ fp_update_ctrls=&CtrlsUpdate;
Bool CtrlInsideRect(CCtrl *c,I64 x,I64 y)
{//screen coordinates
if (c->screen_left<=x<=c->screen_right &&
c->screen_top<=y<=c->screen_bottom)
c->screen_top<=y<=c->screen_bottom)
return TRUE;
else
return FALSE;
@@ -64,7 +64,7 @@ U0 DrawCtrls(CTask *task)
{
CCtrl *c;
CDC *dc=DCAlias(gr.dc2,task);
Bool old_preempt=Preempt(OFF);
Bool old_preempt=Preempt;
c=task->next_ctrl;
while (c!=&task->next_ctrl) {
if (c->flags&CTRLF_SHOW) {
@@ -116,7 +116,7 @@ U0 DrawCtrls(CTask *task)
U0 DrawWinScroll(CDC *dc,CCtrl *c)
{
CWinScroll *s=c->state;
Bool old_preempt=Preempt(OFF);
Bool old_preempt=Preempt;
if (c->flags&CTRLF_CLICKED)
dc->color=s->color>>4;
@@ -140,20 +140,26 @@ U0 WinDerivedScrollValsUpdate(CCtrl *c)
if (s->pos<s->min) s->pos=s->min;
if (s->pos>s->max) s->pos=s->max;
s->color=c->win_task->border_attr&0xF^0xF+
(c->win_task->border_attr&0xF)<<4;
(c->win_task->border_attr&0xF)<<4;
range=s->max-s->min;
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;
}
@@ -165,7 +171,8 @@ U0 LeftClickHWinScroll(CCtrl *c,I64 x,I64,Bool down)
CWinScroll *s=c->state;
I64 range=task->pix_width+2*WIN_SCROLL_BORDER_BONUS-WIN_SCROLL_SIZE;
LBts(&s->flags,WSSf_SET_TO_POS);
s->pos=((x-(FONT_WIDTH-WIN_SCROLL_BORDER_BONUS))*(s->max-s->min+1)+range/2)/range+s->min;
s->pos=((x-(FONT_WIDTH-WIN_SCROLL_BORDER_BONUS))
*(s->max-s->min+1)+range/2)/range+s->min;
if (down)
c->flags|=CTRLF_CLICKED;
else
@@ -180,7 +187,8 @@ U0 LeftClickVWinScroll(CCtrl *c,I64,I64 y,Bool down)
CWinScroll *s=c->state;
I64 range=task->pix_height+2*WIN_SCROLL_BORDER_BONUS-WIN_SCROLL_SIZE;
LBts(&s->flags,WSSf_SET_TO_POS);
s->pos=((y-(FONT_HEIGHT-WIN_SCROLL_BORDER_BONUS))*(s->max-s->min+1)+range/2)/range+s->min;
s->pos=((y-(FONT_HEIGHT-WIN_SCROLL_BORDER_BONUS))
*(s->max-s->min+1)+range/2)/range+s->min;
if (down)
c->flags|=CTRLF_CLICKED;
else
@@ -200,7 +208,7 @@ U0 WheelChangeWinScroll(CCtrl *c,I64 delta)
U0 WinScrollsInit(CTask *task)
{
Bool old_preempt=Preempt(OFF);
Bool old_preempt=Preempt;
CCtrl *c;
if (!CtrlFindUnique(task,CTRLT_WIN_HSCROLL)) {
@@ -241,33 +249,41 @@ U0 DrawViewAnglesCtrl(CDC *dc,CCtrl *c)
CViewAngles *s=c->state;
dc->color=s->cbd;
GrRect(dc, c->left,c->top,VIEWANGLES_SPACING*4+3,VIEWANGLES_SPACING*2+VIEWANGLES_RANGE);
GrRect(dc, c->left,c->top,VIEWANGLES_SPACING*4+3,
VIEWANGLES_SPACING*2+VIEWANGLES_RANGE);
dc->color=s->cbg;
GrRect(dc, c->left+VIEWANGLES_BORDER,c->top+VIEWANGLES_BORDER,
VIEWANGLES_SPACING*4+3-2*VIEWANGLES_BORDER,VIEWANGLES_SPACING*2+VIEWANGLES_RANGE-2*VIEWANGLES_BORDER);
VIEWANGLES_SPACING*4+3-2*VIEWANGLES_BORDER,
VIEWANGLES_SPACING*2+VIEWANGLES_RANGE-2*VIEWANGLES_BORDER);
dc->color=s->cfg;
GrLine(dc,c->left+VIEWANGLES_SPACING,c->top+VIEWANGLES_SPACING,
c->left+VIEWANGLES_SPACING,c->top+VIEWANGLES_SPACING+VIEWANGLES_RANGE-1);
c->left+VIEWANGLES_SPACING,c->top+VIEWANGLES_SPACING+
VIEWANGLES_RANGE-1);
GrLine(dc,c->left+2*VIEWANGLES_SPACING+1,c->top+VIEWANGLES_SPACING,
c->left+2*VIEWANGLES_SPACING+1,c->top+VIEWANGLES_SPACING+VIEWANGLES_RANGE-1);
c->left+2*VIEWANGLES_SPACING+1,c->top+VIEWANGLES_SPACING+
VIEWANGLES_RANGE-1);
GrLine(dc,c->left+3*VIEWANGLES_SPACING+2,c->top+VIEWANGLES_SPACING,
c->left+3*VIEWANGLES_SPACING+2,c->top+VIEWANGLES_SPACING+VIEWANGLES_RANGE-1);
c->left+3*VIEWANGLES_SPACING+2,c->top+VIEWANGLES_SPACING+
VIEWANGLES_RANGE-1);
for (i=1;i<VIEWANGLES_RANGE+1;i+=2*VIEWANGLES_SNAP) {
j=2-i/3&1;
GrLine(dc,c->left+VIEWANGLES_SPACING-j,c->bottom-VIEWANGLES_SPACING-i,
c->left+VIEWANGLES_SPACING+j,c->bottom-VIEWANGLES_SPACING-i);
c->left+VIEWANGLES_SPACING+j,c->bottom
-VIEWANGLES_SPACING-i);
GrLine(dc,c->left+2*VIEWANGLES_SPACING+1-j,c->bottom-VIEWANGLES_SPACING-i,
c->left+2*VIEWANGLES_SPACING+1+j,c->bottom-VIEWANGLES_SPACING-i);
c->left+2*VIEWANGLES_SPACING+1+j,c->bottom
-VIEWANGLES_SPACING-i);
GrLine(dc,c->left+3*VIEWANGLES_SPACING+2-j,c->bottom-VIEWANGLES_SPACING-i,
c->left+3*VIEWANGLES_SPACING+2+j,c->bottom-VIEWANGLES_SPACING-i);
c->left+3*VIEWANGLES_SPACING+2+j,c->bottom
-VIEWANGLES_SPACING-i);
}
dc->color=s->cx;
GrPrint(dc,c->left+VIEWANGLES_SPACING-FONT_WIDTH/2,
c->top+VIEWANGLES_SPACING-(1+FONT_HEIGHT),"X");
c->top+VIEWANGLES_SPACING-(1+FONT_HEIGHT),"X");
GrPrint(dc,c->left+VIEWANGLES_SPACING-3*FONT_WIDTH/2,
c->top+VIEWANGLES_SPACING+VIEWANGLES_RANGE+3,
"%3d",s->sx*360/VIEWANGLES_RANGE);
c->top+VIEWANGLES_SPACING+VIEWANGLES_RANGE+3,
"%3d",s->sx*360/VIEWANGLES_RANGE);
i=c->left+VIEWANGLES_SPACING;
if (s->sx>VIEWANGLES_RANGE/2)
j=-VIEWANGLES_RANGE/2+s->sx;
@@ -280,10 +296,10 @@ U0 DrawViewAnglesCtrl(CDC *dc,CCtrl *c)
dc->color=s->cy;
GrPrint(dc,c->left+2*VIEWANGLES_SPACING+1-FONT_WIDTH/2,
c->top+VIEWANGLES_SPACING-(1+FONT_HEIGHT),"Y");
c->top+VIEWANGLES_SPACING-(1+FONT_HEIGHT),"Y");
GrPrint(dc,c->left+2*VIEWANGLES_SPACING+1-3*FONT_WIDTH/2,
c->top+VIEWANGLES_SPACING+VIEWANGLES_RANGE+3,
"%3d",s->sy*360/VIEWANGLES_RANGE);
c->top+VIEWANGLES_SPACING+VIEWANGLES_RANGE+3,
"%3d",s->sy*360/VIEWANGLES_RANGE);
i=c->left+2*VIEWANGLES_SPACING+1;
if (s->sy>VIEWANGLES_RANGE/2)
j=-VIEWANGLES_RANGE/2+s->sy;
@@ -296,10 +312,10 @@ U0 DrawViewAnglesCtrl(CDC *dc,CCtrl *c)
dc->color=s->cz;
GrPrint(dc,c->left+3*VIEWANGLES_SPACING+2-FONT_WIDTH/2,
c->top+VIEWANGLES_SPACING-(1+FONT_HEIGHT),"Z");
c->top+VIEWANGLES_SPACING-(1+FONT_HEIGHT),"Z");
GrPrint(dc,c->left+3*VIEWANGLES_SPACING+2-3*FONT_WIDTH/2,
c->top+VIEWANGLES_SPACING+VIEWANGLES_RANGE+3,
"%3d",s->sz*360/VIEWANGLES_RANGE);
c->top+VIEWANGLES_SPACING+VIEWANGLES_RANGE+3,
"%3d",s->sz*360/VIEWANGLES_RANGE);
i=c->left+3*VIEWANGLES_SPACING+2;
if (s->sz>VIEWANGLES_RANGE/2)
j=-VIEWANGLES_RANGE/2+s->sz;
@@ -367,7 +383,7 @@ public CCtrl *ViewAnglesNew(CTask *task=NULL)
c->draw_it=&DrawViewAnglesCtrl;
c->left_click=&LeftClickViewAngles;
c->update_derived_vals=&UpdateDerivedViewAnglesCtrl;
old_preempt=Preempt(OFF);
old_preempt=Preempt;
QueIns(c,task->last_ctrl);
TaskDerivedValsUpdate(task);
Preempt(old_preempt);
@@ -378,7 +394,7 @@ public CCtrl *ViewAnglesNew(CTask *task=NULL)
public U0 ViewAnglesDel(CTask *task=NULL)
{//Free view angle ctrl.
CCtrl *c;
Bool old_preempt=Preempt(OFF);
Bool old_preempt=Preempt;
if (!task) task=Fs;
if (c=CtrlFindUnique(task,CTRLT_VIEWING_ANGLES)) {
QueRem(c);
+11 -9
View File
@@ -1,4 +1,4 @@
#define BUTTBORDER 2
#define BUTTON_BORDER 2
#define BTF_DONT_FREE 1
@@ -21,11 +21,12 @@ U0 DrawCtrlButton(CDC *dc,CCtrl *c)
st=s->state_texts;
dc->color=s->state_colors[s->state];
l=StrLen(st);
GrRect(dc,c->left+BUTTBORDER,c->top+BUTTBORDER,
c->right-c->left+1-BUTTBORDER*2,c->bottom-c->top+1-BUTTBORDER*2);
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);
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);
(c->top+c->bottom+1-FONT_HEIGHT)>>1,"%s",st);
}
U0 LeftClickCtrlButton(CCtrl *c,I64,I64,Bool down)
@@ -39,7 +40,8 @@ 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)
I64 num_states=1,U8 *state_texts,
I32 state_colors[],CCtrlButtonState *_s=NULL)
{//Create button ctrl. See $LK,"::/Apps/Strut/Strut.CPP"$.
Bool old_preempt;
CCtrl *result;
@@ -53,9 +55,9 @@ public CCtrl *CtrlButtonNew(I64 x,I64 y,I64 width=-1,I64 height=-1,
j=StrLen(st);
if (j>l) l=j;
}
width=BUTTBORDER*4+l*FONT_WIDTH;
width=BUTTON_BORDER*4+l*FONT_WIDTH;
}
if (height<0) height=BUTTBORDER*4+FONT_HEIGHT;
if (height<0) height=BUTTON_BORDER*4+FONT_HEIGHT;
result=CAlloc(sizeof(CCtrl));
if (_s) {
s=_s;
@@ -77,7 +79,7 @@ public CCtrl *CtrlButtonNew(I64 x,I64 y,I64 width=-1,I64 height=-1,
result->top=y;
result->right=result->left+width-1;
result->bottom=result->top+height-1;
old_preempt=Preempt(OFF);
old_preempt=Preempt;
QueIns(result,Fs->last_ctrl);
Preempt(old_preempt);
return result;
@@ -85,7 +87,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);
Bool old_preempt=Preempt;
QueRem(c);
Preempt(old_preempt);
if (!(c->flags&BTF_DONT_FREE))
+15 -10
View File
@@ -15,7 +15,7 @@ class CTemplateCS
CTemplateCS *CtrlSliderGet()
{
CTemplateCSSlider *temps;
U8 *st,pmt[136];
U8 *st,pmt[STR_LEN];
CTemplateCS *result=CAlloc(sizeof(CTemplateCS));
"$$PURPLE$$Ctrl Slider$$FG$$\n\n";
@@ -85,14 +85,15 @@ U0 DrawCtrlSlider(CDC *dc,CCtrl *c)
GrRect(dc, c->left,c->top,%d*SLIDER_SPACING+%d,SLIDER_SPACING*2+SLIDER_RANGE);
dc->color=BLUE;
GrRect(dc, c->left+SLIDER_BORDER,c->top+SLIDER_BORDER,
%d*SLIDER_SPACING+%d-2*SLIDER_BORDER,SLIDER_SPACING*2+SLIDER_RANGE-2*SLIDER_BORDER);
%d*SLIDER_SPACING+%d-2*SLIDER_BORDER,SLIDER_SPACING*2
+SLIDER_RANGE-2*SLIDER_BORDER);
dc->color=BLACK;
",m->num_sliders+1,m->num_sliders,m->num_sliders+1,m->num_sliders);
for (i=0;i<m->num_sliders;i++)
DocPrint(doc,
" GrLine(dc,c->left+%d*SLIDER_SPACING+%d,c->top+SLIDER_SPACING,
c->left+%d*SLIDER_SPACING+%d,c->top+SLIDER_SPACING+SLIDER_RANGE-1);
c->left+%d*SLIDER_SPACING+%d,c->top+SLIDER_SPACING+SLIDER_RANGE-1);
",i+1,i,i+1,i);
DocPrint(doc," dc->color=LTRED;\n");
@@ -109,7 +110,9 @@ U0 DrawCtrlSlider(CDC *dc,CCtrl *c)
temps=m->next_slider;
while (temps!=&m->next_slider) {
DocPrint(doc," GrRect(dc,c->left+%d*SLIDER_SPACING+%d-3,c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->%s-2,7,5);\n",
DocPrint(doc,
" GrRect(dc,c->left+%d*SLIDER_SPACING+%d-3,"
"c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->%s-2,7,5);\n",
temps->num+1,temps->num,temps->name);
temps=temps->next;
}
@@ -117,7 +120,8 @@ U0 DrawCtrlSlider(CDC *dc,CCtrl *c)
temps=m->next_slider;
while (temps!=&m->next_slider) {
DocPrint(doc," GrRect(dc,c->left+%d*SLIDER_SPACING+%d-2,c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->%s-1,5,3);\n",
DocPrint(doc," GrRect(dc,c->left+%d*SLIDER_SPACING+%d-2,"
"c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->%s-1,5,3);\n",
temps->num+1,temps->num,temps->name);
temps=temps->next;
}
@@ -135,7 +139,8 @@ U0 UpdateDerivedCtrlSlider(CCtrl *c)
temps=m->next_slider;
while (temps!=&m->next_slider) {
DocPrint(doc," s->%s=ClampI64(s->%s,0,SLIDER_RANGE-1);\n",temps->name,temps->name);
DocPrint(doc," s->%s=ClampI64(s->%s,0,SLIDER_RANGE-1);\n",
temps->name,temps->name);
temps=temps->next;
}
DocPrint(doc,
@@ -177,14 +182,14 @@ CCtrl *SliderNew()
");
if (*m->glbl_name)
DocPrint(doc," c->state=&%s;\n"
" MemSet(&%s,0,sizeof(CSliderState));\n",m->glbl_name,m->glbl_name);
" MemSet(&%s,0,sizeof(CSliderState));\n",m->glbl_name,m->glbl_name);
else
DocPrint(doc, " c->state=CAlloc(sizeof(CSliderState));\n");
DocPrint(doc,
" c->draw_it=&DrawCtrlSlider;
c->left_click=&LeftClickSlider;
c->update_derived_vals=&UpdateDerivedCtrlSlider;
old_preempt=Preempt(OFF);
old_preempt=Preempt;
QueIns(c,Fs->last_ctrl);
TaskDerivedValsUpdate;
Preempt(old_preempt);
@@ -193,7 +198,7 @@ CCtrl *SliderNew()
U0 SliderDel(CCtrl *c)
{
Bool old_preempt=Preempt(OFF);
Bool old_preempt=Preempt;
QueRem(c);
Preempt(old_preempt);
");
@@ -206,7 +211,7 @@ U0 SliderDel(CCtrl *c)
Kill(task); //This frees memory.
AcctOneTimePopUp(ARf_MANAGE_SLIDER,
RegOneTimePopUp(ARf_MANAGE_SLIDER,
"Modify the code to your heart's content.\n"
"The code is no longer managed.\n");