summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Menu_.cxx10
-rw-r--r--src/fl_draw.cxx6
-rw-r--r--src/fl_symbols.cxx40
3 files changed, 50 insertions, 6 deletions
diff --git a/src/Fl_Menu_.cxx b/src/Fl_Menu_.cxx
index 60712a9ef..28a476e02 100644
--- a/src/Fl_Menu_.cxx
+++ b/src/Fl_Menu_.cxx
@@ -359,10 +359,11 @@ void Fl_Menu_::setonly(Fl_Menu_Item* item) {
}
/** Turns the radio item "on" for the menu item and turns "off" adjacent radio items set.
- \deprecated This method is dangerous if radio items are first in the menu.
- Use Fl_Menu_::setonly(Fl_Menu_Item*) instead.
+ \note This method is dangerous if radio items are first in the menu.
+ Make sure that \p first is set ciorrectly or use Fl_Menu_::setonly(Fl_Menu_Item*) instead.
+ \param[in] first start of menu array or NULL (default) if the radio group is not the first item
*/
-void Fl_Menu_Item::setonly() {
+void Fl_Menu_Item::setonly(Fl_Menu_Item const* first) {
flags |= FL_MENU_RADIO | FL_MENU_VALUE;
Fl_Menu_Item* j;
for (j = this; ; ) { // go down
@@ -371,9 +372,10 @@ void Fl_Menu_Item::setonly() {
if (!j->text || !j->radio()) break; // stop after group
j->clear();
}
- for (j = this-1; ; j--) { // go up
+ if (this != first) for (j = this-1; ; j--) { // go up
if (!j->text || (j->flags&FL_MENU_DIVIDER) || !j->radio()) break;
j->clear();
+ if (j == first) break;
}
}
diff --git a/src/fl_draw.cxx b/src/fl_draw.cxx
index 04ebbc6e0..5073d4ee4 100644
--- a/src/fl_draw.cxx
+++ b/src/fl_draw.cxx
@@ -43,15 +43,17 @@ static char* underline_at;
*/
static const char* expand_text_(const char* from, char*& buf, int maxbuf, double maxw, int& n,
double &width, int wrap, int draw_symbols) {
- char* e = buf+(maxbuf-4);
underline_at = 0;
double w = 0;
static int l_local_buff = 500;
static char *local_buf = (char*)malloc(l_local_buff); // initial buffer allocation
+ char* e;
if (maxbuf == 0) {
buf = local_buf;
e = buf + l_local_buff - 4;
- }
+ } else {
+ e = buf+(maxbuf-4);
+ }
char* o = buf;
char* word_end = o;
const char* word_start = from;
diff --git a/src/fl_symbols.cxx b/src/fl_symbols.cxx
index e6ebb4199..2cb586ccb 100644
--- a/src/fl_symbols.cxx
+++ b/src/fl_symbols.cxx
@@ -655,6 +655,43 @@ static void draw_redo(Fl_Color c) {
fl_scale(-1.0, 1.0);
}
+static void draw_open_box(Fl_Color col) {
+ fl_color(col);
+ BCP;
+ vv(-1.0, -1.0); vv(-0.4, -1.0); vv(-0.4, -0.75); vv(-0.75, -0.75);
+ vv(-0.75, 0.75); vv(0.75, 0.75); vv(0.75, 0.4); vv(1.0, 0.4); vv(1.0, 1.0);
+ vv(-1.0, 1.0);
+ ECP;
+ set_outline_color(col);
+ BC;
+ vv(-1.0, -1.0); vv(-0.4, -1.0); vv(-0.4, -0.75); vv(-0.75, -0.75);
+ vv(-0.75, 0.75); vv(0.75, 0.75); vv(0.75, 0.4); vv(1.0, 0.4); vv(1.0, 1.0);
+ vv(-1.0, 1.0);
+ EC;
+}
+
+static void draw_import(Fl_Color col)
+{
+ fl_push_matrix();
+ fl_scale(-1.0, 1.0);
+ draw_open_box(col);
+ fl_scale(-1.0, 1.0);
+ fl_translate(-0.8, -0.3);
+ fl_rotate(45.0+90);
+ draw_round_arrow(col, 3);
+ fl_pop_matrix();
+}
+
+static void draw_export(Fl_Color col)
+{
+ draw_open_box(col);
+ fl_push_matrix();
+ fl_translate(0.7, 0.1);
+ fl_rotate(225.0);
+ draw_round_arrow(col, 3);
+ fl_pop_matrix();
+}
+
static void fl_init_symbols(void) {
static char beenhere;
if (beenhere) return;
@@ -702,5 +739,8 @@ static void fl_init_symbols(void) {
fl_add_symbol("undo", draw_undo, 1);
fl_add_symbol("redo", draw_redo, 1);
+ fl_add_symbol("import", draw_import, 1);
+ fl_add_symbol("export", draw_export, 1);
+
// fl_add_symbol("file", draw_file, 1);
}