summaryrefslogtreecommitdiff
path: root/app/bin/cmisc.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/cmisc.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/cmisc.c')
-rw-r--r--app/bin/cmisc.c114
1 files changed, 84 insertions, 30 deletions
diff --git a/app/bin/cmisc.c b/app/bin/cmisc.c
index a353530..b41ae42 100644
--- a/app/bin/cmisc.c
+++ b/app/bin/cmisc.c
@@ -23,6 +23,7 @@
#include <stdint.h>
#include "common.h"
+#include "utility.h"
#include "cundo.h"
#include "i18n.h"
#include "messages.h"
@@ -32,6 +33,10 @@
EXPORT wIndex_t describeCmdInx;
EXPORT BOOL_T inDescribeCmd;
+extern wIndex_t selectCmdInx;
+extern wIndex_t joinCmdInx;
+extern wIndex_t modifyCmdInx;
+
static track_p descTrk;
static descData_p descData;
static descUpdate_t descUpdateFunc;
@@ -43,13 +48,16 @@ static BOOL_T descNeedDrawHilite;
static wPos_t describeW_posy;
static wPos_t describeCmdButtonEnd;
+static wMenu_p descPopupM;
+
static unsigned int editableLayerList[NUM_LAYERS]; /**< list of non-frozen layers */
static int * layerValue; /**pointer to current Layer (int *) */
static paramFloatRange_t rdata = { 0, 0, 100, PDO_NORANGECHECK_HIGH|PDO_NORANGECHECK_LOW };
static paramIntegerRange_t idata = { 0, 0, 100, PDO_NORANGECHECK_HIGH|PDO_NORANGECHECK_LOW };
static paramTextData_t tdata = { 300, 150 };
-static char * pivotLabels[] = { N_("First"), N_("Middle"), N_("Second"), NULL };
+static char * pivotLabels[] = { N_("First"), N_("Middle"), N_("End"), NULL };
+static char * boxLabels[] = { "", NULL };
static paramData_t describePLs[] = {
#define I_FLOAT_0 (0)
{ PD_FLOAT, NULL, "F1", 0, &rdata },
@@ -114,13 +122,15 @@ static paramData_t describePLs[] = {
#define I_LAYER_N I_LAYER_0+1
#define I_COLOR_0 I_LAYER_N
- { PD_COLORLIST, NULL, "C1", 0, NULL, N_("Color") },
+ { PD_COLORLIST, NULL, "C1", PDO_NOPREF, NULL, N_("Color"), BC_HORZ|BC_NOBORDER },
#define I_COLOR_N I_COLOR_0+1
#define I_LIST_0 I_COLOR_N
{ PD_DROPLIST, NULL, "L1", 0, (void*)150, NULL, 0 },
{ PD_DROPLIST, NULL, "L2", 0, (void*)150, NULL, 0 },
-#define I_LIST_N I_LIST_0+2
+ { PD_DROPLIST, NULL, "L3", 0, (void*)150, NULL, 0 },
+ { PD_DROPLIST, NULL, "L4", 0, (void*)150, NULL, 0 },
+#define I_LIST_N I_LIST_0+4
#define I_EDITLIST_0 I_LIST_N
{ PD_DROPLIST, NULL, "LE1", 0, (void*)150, NULL, BL_EDITABLE },
@@ -131,8 +141,15 @@ static paramData_t describePLs[] = {
#define I_TEXT_N I_TEXT_0+1
#define I_PIVOT_0 I_TEXT_N
- { PD_RADIO, NULL, "P1", 0, pivotLabels, N_("Pivot"), BC_HORZ|BC_NOBORDER, 0 }
+ { PD_RADIO, NULL, "P1", 0, pivotLabels, N_("Pivot"), BC_HORZ|BC_NOBORDER, 0 },
#define I_PIVOT_N I_PIVOT_0+1
+
+#define I_TOGGLE_0 I_PIVOT_N
+ { PD_TOGGLE, NULL, "boxed1", PDO_NOPREF|PDO_DLGHORZ, boxLabels, N_("Boxed"), BC_HORZ|BC_NOBORDER },
+ { PD_TOGGLE, NULL, "boxed2", PDO_NOPREF|PDO_DLGHORZ, boxLabels, N_("Boxed"), BC_HORZ|BC_NOBORDER },
+ { PD_TOGGLE, NULL, "boxed3", PDO_NOPREF|PDO_DLGHORZ, boxLabels, N_("Boxed"), BC_HORZ|BC_NOBORDER },
+ { PD_TOGGLE, NULL, "boxed4", PDO_NOPREF|PDO_DLGHORZ, boxLabels, N_("Boxed"), BC_HORZ|BC_NOBORDER },
+#define I_TOGGLE_N I_TOGGLE_0+4
};
static paramGroup_t describePG = { "describe", 0, describePLs, sizeof describePLs/sizeof describePLs[0] };
@@ -149,7 +166,7 @@ CreateEditableLayersList()
int i = 0;
int j = 0;
- while (i <= NUM_LAYERS) {
+ while (i < NUM_LAYERS) {
if (!GetLayerFrozen(i)) {
editableLayerList[j++] = i;
}
@@ -179,7 +196,7 @@ SearchEditableLayerList(unsigned int layer)
return (-1);
}
-static void DrawDescHilite(void)
+static void DrawDescHilite(BOOL_T selected)
{
wPos_t x, y, w, h;
@@ -194,7 +211,7 @@ static void DrawDescHilite(void)
w = (wPos_t)((descSize.x/mainD.scale)*mainD.dpi+0.5);
h = (wPos_t)((descSize.y/mainD.scale)*mainD.dpi+0.5);
mainD.CoOrd2Pix(&mainD,descOrig,&x,&y);
- wDrawFilledRectangle(mainD.d, x, y, w, h, descColor, wDrawOptTemp);
+ wDrawFilledRectangle(tempD.d, x, y, w, h, selected?descColor:wDrawColorBlue, wDrawOptTemp|wDrawOptTransparent);
}
@@ -221,10 +238,6 @@ static void DescribeUpdate(
return;
}
- if ((ddp->mode&DESC_NOREDRAW) == 0) {
- DrawDescHilite();
- }
-
if (!descUndoStarted) {
UndoStart(_("Change Track"), "Change Track");
descUndoStarted = TRUE;
@@ -252,7 +265,6 @@ static void DescribeUpdate(
descOrig.y -= descBorder;
descSize.x -= descOrig.x-descBorder;
descSize.y -= descOrig.y-descBorder;
- DrawDescHilite();
}
for (inx = 0; inx < sizeof describePLs/sizeof describePLs[0]; inx++) {
@@ -288,9 +300,6 @@ static void DescOk(void * junk)
{
wHide(describePG.win);
- if (descTrk) {
- DrawDescHilite();
- }
if (layerValue && *layerValue>=0) {
SetTrkLayer(descTrk, editableLayerList[*layerValue]); //int found that is really in the parm controls.
}
@@ -304,7 +313,7 @@ static void DescOk(void * junk)
}
descNeedDrawHilite = FALSE;
- Reset();
+ Reset(); // DescOk
}
@@ -326,10 +335,22 @@ static struct {
/*STRING*/ { PD_STRING,0, I_STRING_0, I_STRING_N },
/*TEXT*/ { PD_TEXT, PDO_DLGNOLABELALIGN, I_TEXT_0, I_TEXT_N },
/*LIST*/ { PD_DROPLIST, PDO_LISTINDEX, I_LIST_0, I_LIST_N },
- /*EDITABLELIST*/{ PD_DROPLIST, 0, I_EDITLIST_0, I_EDITLIST_N }
+ /*EDITABLELIST*/{ PD_DROPLIST, 0, I_EDITLIST_0, I_EDITLIST_N },
+ /*BOXED*/ { PD_TOGGLE, 0, I_TOGGLE_0, I_TOGGLE_N },
};
-static wControl_p AllocateButt(descData_p ddp, void * valueP, char * label,
+/**
+ * An unused param element is selected from the list of pre-defined param elements and initialized
+ * for an element specific param.
+ *
+ * \param ddp Element specific param
+ * \param valueP the value pointer used by the element
+ * \param label the label assigned by the element
+ * \param sep ?
+ * \return the selected widget
+ */
+
+static wControl_p AssignParamToDescribeDialog(descData_p ddp, void * valueP, char * label,
wPos_t sep)
{
int inx;
@@ -364,7 +385,7 @@ static wControl_p AllocateButt(descData_p ddp, void * valueP, char * label,
}
}
- AbortProg("allocateButt: can't find %d", ddp->type);
+ AbortProg("AssignParamToDescribeDialog: can't find %d", ddp->type);
return NULL;
}
@@ -465,13 +486,13 @@ void DoDescribe(char * title, track_p trk, descData_p data, descUpdate_t update)
label = _(ddp->label);
ddp->posy = describeW_posy;
- ddp->control0 = AllocateButt(ddp, ddp->valueP, label,
+ ddp->control0 = AssignParamToDescribeDialog(ddp, ddp->valueP, label,
(ddp->type == DESC_POS?3:3));
wControlActive(ddp->control0, ((ddp->mode|ro_mode)&DESC_RO)==0);
switch (ddp->type) {
case DESC_POS:
- ddp->control1 = AllocateButt(ddp,
+ ddp->control1 = AssignParamToDescribeDialog(ddp,
&((coOrd*)(ddp->valueP))->y,
NULL,
0);
@@ -523,9 +544,10 @@ EXPORT void DescribeCancel(void)
{
if (describePG.win && wWinIsVisible(describePG.win)) {
if (descTrk) {
- descUpdateFunc(descTrk, -1, descData, TRUE);
- descTrk = NULL;
- DrawDescHilite();
+ if (!IsTrackDeleted(descTrk))
+ descUpdateFunc(descTrk, -1, descData, TRUE);
+ descTrk = NULL;
+
}
wHide(describePG.win);
@@ -540,21 +562,27 @@ EXPORT void DescribeCancel(void)
}
-static STATUS_T CmdDescribe(wAction_t action, coOrd pos)
+EXPORT STATUS_T CmdDescribe(wAction_t action, coOrd pos)
{
- track_p trk;
+ static track_p trk;
char msg[STR_SIZE];
switch (action) {
case C_START:
InfoMessage(_("Select track to describe"));
+ wSetCursor(mainD.d,wCursorQuestion);
descUndoStarted = FALSE;
+ trk = NULL;
return C_CONTINUE;
+ case wActionMove:
+ trk = OnTrack(&pos, FALSE, FALSE);
+ return C_CONTINUE;
+
+
case C_DOWN:
if ((trk = OnTrack(&pos, FALSE, FALSE)) != NULL) {
if (describePG.win && wWinIsVisible(describePG.win) && descTrk) {
- DrawDescHilite();
descUpdateFunc(descTrk, -1, descData, TRUE);
descTrk = NULL;
}
@@ -572,10 +600,10 @@ static STATUS_T CmdDescribe(wAction_t action, coOrd pos)
descSize.x -= descOrig.x-descBorder;
descSize.y -= descOrig.y-descBorder;
descNeedDrawHilite = TRUE;
- DrawDescHilite();
DescribeTrack(trk, msg, 255);
inDescribeCmd = FALSE;
InfoMessage(msg);
+ trk = NULL;
} else {
InfoMessage("");
}
@@ -583,17 +611,31 @@ static STATUS_T CmdDescribe(wAction_t action, coOrd pos)
return C_CONTINUE;
case C_REDRAW:
+
if (describePG.win && wWinIsVisible(describePG.win) && descTrk) {
- DrawDescHilite();
+ DrawDescHilite(TRUE);
+ if (descTrk && QueryTrack(descTrk, Q_IS_DRAW)) {
+ DrawOriginAnchor(descTrk);
+ }
+ } else if (trk){
+ DrawTrack(trk,&tempD,wDrawColorPreviewSelected);
}
+
break;
case C_CANCEL:
DescribeCancel();
+ wSetCursor(mainD.d,defaultCursor);
return C_CONTINUE;
+
+ case C_CMDMENU:
+ menuPos = pos;
+ if (!trk) wMenuPopupShow(descPopupM);
+ return C_CONTINUE;
}
+
return C_CONTINUE;
}
@@ -601,11 +643,23 @@ static STATUS_T CmdDescribe(wAction_t action, coOrd pos)
#include "bitmaps/describe.xpm"
+extern wIndex_t selectCmdInx;
+extern wIndex_t modifyCmdInx;
+extern wIndex_t panCmdInx;
+
void InitCmdDescribe(wMenu_p menu)
{
describeCmdInx = AddMenuButton(menu, CmdDescribe, "cmdDescribe",
_("Properties"), wIconCreatePixMap(describe_xpm),
- LEVEL0, IC_CANCEL|IC_POPUP, ACCL_DESCRIBE, NULL);
+ LEVEL0, IC_CANCEL|IC_POPUP|IC_WANT_MOVE|IC_CMDMENU, ACCL_DESCRIBE, NULL);
RegisterChangeNotification(DescChange);
ParamRegister(&describePG);
}
+void InitCmdDescribe2(wMenu_p menu)
+{
+ descPopupM = MenuRegister( "Describe Context Menu" );
+ wMenuPushCreate(descPopupM, "cmdSelectMode", GetBalloonHelpStr("cmdSelectMode"), 0, DoCommandB, (void*) (intptr_t) selectCmdInx);
+ wMenuPushCreate(descPopupM, "cmdModifyMode", GetBalloonHelpStr("cmdModifyMode"), 0, DoCommandB, (void*) (intptr_t) modifyCmdInx);
+ wMenuPushCreate(descPopupM, "cmdPanMode", GetBalloonHelpStr("cmdPanMode"), 0, DoCommandB, (void*) (intptr_t) panCmdInx);
+
+}