summaryrefslogtreecommitdiff
path: root/app/bin/ctext.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2020-08-24 21:26:53 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2020-08-24 21:26:53 +0200
commitdf247efec654e512242e4f4f1b0212034f9e01fe (patch)
tree25c02e16957f3aa613af30c140fd8e8a3d52fda6 /app/bin/ctext.c
parentd0b6a8a4ec298024f14f704f9e40a6f9d324ccf3 (diff)
parenta5ade52caa489cf0a713e0f02b764000d203140e (diff)
Merge branch 'release/debian/1%5.2.0Beta2.1-1' into masterdebian/1%5.2.0Beta2.1-1
Diffstat (limited to 'app/bin/ctext.c')
-rw-r--r--app/bin/ctext.c71
1 files changed, 24 insertions, 47 deletions
diff --git a/app/bin/ctext.c b/app/bin/ctext.c
index ca0c7c7..c292d1c 100644
--- a/app/bin/ctext.c
+++ b/app/bin/ctext.c
@@ -30,7 +30,7 @@
#include "draw.h"
#include "misc.h"
-track_p NewText( wIndex_t index, coOrd p, ANGLE_T angle, char * text, CSIZE_T textSize, wDrawColor color );
+track_p NewText( wIndex_t index, coOrd p, ANGLE_T angle, char * text, CSIZE_T textSize, wDrawColor color, BOOL_T boxed );
void LoadFontSizeList( wList_p, long );
void UpdateFontSizeList( long *, wList_p, wIndex_t );
@@ -57,13 +57,17 @@ static struct {
wIndex_t fontSizeInx;
char text[STR_LONG_SIZE];
wDrawColor color;
+ BOOL_T boxed;
} Dt;
+static char * boxLabels[] = { "", NULL };
static paramData_t textPLs[] = {
#define textPD (textPLs[0])
- { PD_DROPLIST, &Dt.fontSizeInx, "fontsize", 0, NULL, N_("Font Size"), BL_EDITABLE },
+ { PD_DROPLIST, &Dt.fontSizeInx, "Fontsize", 0, NULL, N_("Font Size"), BL_EDITABLE },
#define colorPD (textPLs[1])
- { PD_COLORLIST, &Dt.color, "color", PDO_NORECORD, NULL, N_("Color") }
+ { PD_COLORLIST, &Dt.color, "Color", PDO_NORECORD, NULL, N_("Color") },
+#define boxPD (textPLs[2])
+ { PD_TOGGLE, &Dt.boxed, "Boxed", 0, boxLabels, N_("Boxed"), 0 }
};
static paramGroup_t textPG = { "text", 0, textPLs, sizeof textPLs/sizeof textPLs[0] };
@@ -83,29 +87,21 @@ static void TextDlgUpdate(
switch (inx) {
case 0:
case 1:
- if ( Dt.state == SHOW_TEXT) {
- DrawMultiString( &tempD, Dt.pos, Dt.text, NULL, (FONTSIZE_T)Dt.size, Dt.color, 0, NULL, NULL );
- DrawLine( &tempD, Dt.cursPos0, Dt.cursPos1, 0, Dt.color );
- }
+ case 2:
UpdateFontSizeList( &Dt.size, (wList_p)textPLs[0].control, Dt.fontSizeInx );
- /*wWinSetBusy( mainW, TRUE );*/
if ( Dt.state == SHOW_TEXT) {
DrawMultiLineTextSize( &mainD, Dt.text, NULL, Dt.size, TRUE, &size, &lastline);
Dt.textLen = size.x;
Dt.lastLineLen = lastline.x;
Dt.lastLineOffset = lastline.y;
}
+ wSetSelectedFontSize((wFontSize_t)Dt.size); //Update for next time
DrawTextSize( &mainD, "Aquilp", NULL, Dt.size, TRUE, &size );
Dt.cursHeight = size.y;
- /*wWinSetBusy( mainW, FALSE );*/
if ( Dt.state == SHOW_TEXT) {
Dt.cursPos0.x = Dt.cursPos1.x = Dt.pos.x+Dt.lastLineLen;
Dt.cursPos1.y = Dt.pos.y+Dt.cursHeight+Dt.lastLineOffset;
- DrawLine( &tempD, Dt.cursPos0, Dt.cursPos1, 0, Dt.color );
- DrawMultiString( &tempD, Dt.pos, Dt.text, NULL, (FONTSIZE_T)Dt.size, Dt.color, 0, NULL, NULL );
}
- MainRedraw();
- MapRedraw();
break;
}
}
@@ -115,8 +111,8 @@ static STATUS_T CmdText( wAction_t action, coOrd pos )
{
track_p t;
unsigned char c;
- wControl_p controls[3];
- char * labels[2];
+ wControl_p controls[4];
+ char * labels[3];
coOrd size, lastline;
switch (action & 0xFF) {
@@ -141,23 +137,21 @@ static STATUS_T CmdText( wAction_t action, coOrd pos )
ParamLoadControls(&textPG);
ParamGroupRecord( &textPG );
- if (!inPlayback)
- wWinSetBusy(mainW, TRUE);
DrawTextSize(&mainD, "Aquilp", NULL, Dt.size, TRUE, &size);
Dt.cursHeight = size.y;
- if (!inPlayback)
- wWinSetBusy(mainW, FALSE);
controls[0] = textPD.control;
controls[1] = colorPD.control;
- controls[2] = 0;
+ controls[2] = boxPD.control;
+ controls[3] = 0;
labels[0] = N_("Font Size");
labels[1] = N_("Color");
+ labels[2] = N_("Boxed");
InfoSubstituteControls( controls, labels );
return C_CONTINUE;
break;
case C_DOWN:
- if (Dt.state != 0) {
+ if (Dt.state != POSITION_TEXT) {
}
Dt.pos = pos;
Dt.cursPos0.y = Dt.cursPos1.y = pos.y + Dt.lastLineOffset;
@@ -165,21 +159,13 @@ static STATUS_T CmdText( wAction_t action, coOrd pos )
DrawTextSize(&mainD, "Aquilp", NULL, Dt.size, TRUE, &size); //In case fontsize change
Dt.cursHeight = size.y;
Dt.cursPos1.y += Dt.cursHeight;
- DrawLine( &tempD, Dt.cursPos0, Dt.cursPos1, 0, Dt.color );
- DrawMultiString(&tempD, Dt.pos, Dt.text, NULL, (FONTSIZE_T)Dt.size, Dt.color, 0.0, NULL, NULL );
Dt.state = SHOW_TEXT;
- MainRedraw();
- MapRedraw();
return C_CONTINUE;
case C_MOVE:
Dt.pos = pos;
Dt.cursPos0.y = Dt.cursPos1.y = pos.y + Dt.lastLineOffset;
Dt.cursPos0.x = Dt.cursPos1.x = pos.x + Dt.lastLineLen;
Dt.cursPos1.y += Dt.cursHeight;
- DrawLine( &tempD, Dt.cursPos0, Dt.cursPos1, 0, wDrawColorBlack );
- DrawMultiString(&tempD, Dt.pos, Dt.text, NULL, (FONTSIZE_T)Dt.size, Dt.color, 0.0, NULL, NULL );
- MainRedraw();
- MapRedraw();
return C_CONTINUE;
case C_UP:
return C_CONTINUE;
@@ -188,8 +174,7 @@ static STATUS_T CmdText( wAction_t action, coOrd pos )
NoticeMessage( MSG_SEL_POS_FIRST, _("Ok"), NULL );
return C_CONTINUE;
}
- DrawLine( &tempD, Dt.cursPos0, Dt.cursPos1, 0, Dt.color );
- DrawMultiString(&tempD, Dt.pos, Dt.text, NULL, (FONTSIZE_T)Dt.size, Dt.color, 0.0, NULL, NULL );
+
c = (unsigned char)(action >> 8);
switch (c) {
case '\b':
@@ -209,7 +194,7 @@ static STATUS_T CmdText( wAction_t action, coOrd pos )
break;
case '\015':
UndoStart( _("Create Text"), "newText - CR" );
- t = NewText( 0, Dt.pos, Dt.angle, Dt.text, (CSIZE_T)Dt.size, Dt.color );
+ t = NewText( 0, Dt.pos, Dt.angle, Dt.text, (CSIZE_T)Dt.size, Dt.color, Dt.boxed );
UndoEnd();
DrawNewTrack(t);
Dt.state = POSITION_TEXT;
@@ -227,42 +212,33 @@ static STATUS_T CmdText( wAction_t action, coOrd pos )
Dt.lastLineOffset = lastline.y;
Dt.cursPos0.x = Dt.cursPos1.x = Dt.pos.x + Dt.lastLineLen;
Dt.cursPos0.y = Dt.cursPos1.y = Dt.pos.y + Dt.lastLineOffset;
- DrawTextSize(&mainD, "Aquilp", NULL, Dt.size, TRUE, &size); //In case fontsize change
+ POS_T descent, ascent;
+ DrawTextSize2(&mainD, "Aquilp", NULL, Dt.size, TRUE, &size, &descent, &ascent); //In case fontsize change
Dt.cursHeight = size.y;
+ Dt.cursPos0.y -=descent;
Dt.cursPos1.y +=Dt.cursHeight;
- MainRedraw();
- MapRedraw();
- //DrawLine( &tempD, Dt.cursPos0, Dt.cursPos1, 0, Dt.color );
- //DrawMultiString(&tempD, Dt.pos, Dt.text, NULL, (FONTSIZE_T)Dt.size, Dt.color, 0.0, NULL, NULL );
return C_CONTINUE;
case C_REDRAW:
- if (Dt.state == 1) {
- DrawLine( &tempD, Dt.cursPos0, Dt.cursPos1, 0, Dt.color );
- DrawMultiString(&tempD, Dt.pos, Dt.text, NULL, (FONTSIZE_T)Dt.size, Dt.color, 0.0, NULL, NULL );
- }
+ DrawLine( &tempD, Dt.cursPos0, Dt.cursPos1, 0, Dt.color );
+ DrawMultiString(&tempD, Dt.pos, Dt.text, NULL, (FONTSIZE_T)Dt.size, Dt.color, 0.0, NULL, NULL, Dt.boxed );
return C_CONTINUE;
case C_CANCEL:
if (Dt.state != POSITION_TEXT) {
Dt.state = POSITION_TEXT;
}
InfoSubstituteControls( NULL, NULL );
- MainRedraw();
- MapRedraw();
return C_TERMINATE;
case C_OK:
if (Dt.state != POSITION_TEXT) {
- DrawLine( &tempD, Dt.cursPos0, Dt.cursPos1, 0, Dt.color );
Dt.state = POSITION_TEXT;
if (Dt.len) {
UndoStart( _("Create Text"), "newText - OK" );
- t = NewText( 0, Dt.pos, Dt.angle, Dt.text, (CSIZE_T)Dt.size, Dt.color );
+ t = NewText( 0, Dt.pos, Dt.angle, Dt.text, (CSIZE_T)Dt.size, Dt.color, Dt.boxed );
UndoEnd();
DrawNewTrack(t);
}
}
InfoSubstituteControls( NULL, NULL );
- MainRedraw();
- MapRedraw();
return C_TERMINATE;
case C_FINISH:
@@ -273,6 +249,7 @@ static STATUS_T CmdText( wAction_t action, coOrd pos )
return C_TERMINATE;
case C_CMDMENU:
+ menuPos = pos;
wMenuPopupShow( textPopupM );
return C_CONTINUE;
}