diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2022-02-06 16:04:57 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2022-02-06 16:04:57 +0100 |
commit | 59dccf358523dfc7679d1d8c120452a71e42243c (patch) | |
tree | f0f3cc006e8157d6bd699bd644b7dd7b35387ac2 /app/bin/ctext.c | |
parent | fd6639655b399a79fb72f494786a4f57da9c90e7 (diff) | |
parent | d0ca838c7ab297036b4a7c45351761a48fe05efd (diff) |
Merge branch 'feature/upstrem' into develop
Diffstat (limited to 'app/bin/ctext.c')
-rw-r--r-- | app/bin/ctext.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/app/bin/ctext.c b/app/bin/ctext.c index c292d1c..3ab301c 100644 --- a/app/bin/ctext.c +++ b/app/bin/ctext.c @@ -22,13 +22,11 @@ #include "cundo.h" #include "fileio.h" -#include "i18n.h" -#include "messages.h" #include "param.h" #include "track.h" -#include "wlib.h" #include "draw.h" #include "misc.h" +#include "common-ui.h" track_p NewText( wIndex_t index, coOrd p, ANGLE_T angle, char * text, CSIZE_T textSize, wDrawColor color, BOOL_T boxed ); @@ -55,7 +53,7 @@ static struct { ANGLE_T angle; long size; wIndex_t fontSizeInx; - char text[STR_LONG_SIZE]; + char text[STR_HUGE_SIZE]; wDrawColor color; BOOL_T boxed; } Dt; @@ -63,13 +61,13 @@ static struct { 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 } + { PD_TOGGLE, &Dt.boxed, "boxed", 0, boxLabels, N_("Boxed"), 0 } }; -static paramGroup_t textPG = { "text", 0, textPLs, sizeof textPLs/sizeof textPLs[0] }; +static paramGroup_t textPG = { "text", 0, textPLs, COUNT( textPLs ) }; enum TEXT_POSITION { @@ -206,6 +204,12 @@ static STATUS_T CmdText( wAction_t action, coOrd pos ) Dt.text[Dt.len] = '\000'; } } + if (Dt.len>sizeof(Dt.text)-8) { + Dt.len=sizeof(Dt.text)-8; + Dt.text[Dt.len] = '\0'; + InfoMessage("Text too long - truncated"); + wBeep(); + } DrawMultiLineTextSize( &mainD, Dt.text, NULL, Dt.size, TRUE, &size, &lastline); Dt.textLen = size.x; Dt.lastLineLen = lastline.x; @@ -261,9 +265,9 @@ static STATUS_T CmdText( wAction_t action, coOrd pos ) void InitCmdText( wMenu_p menu ) { - AddMenuButton( menu, CmdText, "cmdText", _("Text"), wIconCreatePixMap(text_xpm), LEVEL0_50, IC_STICKY|IC_CMDMENU|IC_POPUP2, ACCL_TEXT, NULL ); + AddMenuButton( menu, CmdText, "cmdText", _("Text"), wIconCreatePixMap(text_xpm[iconSize]), LEVEL0_50, IC_STICKY|IC_CMDMENU|IC_POPUP2, ACCL_TEXT, NULL ); textPopupM = MenuRegister( "Text Font" ); - wMenuPushCreate( textPopupM, "", _("Fonts..."), 0, (wMenuCallBack_p)SelectFont, NULL ); + wMenuPushCreate( textPopupM, "", _("Fonts..."), 0, SelectFont, NULL ); Dt.size = (CSIZE_T)wSelectedFontSize(); Dt.color = wDrawColorBlack; } |