pull/2/head
Stelios Bounanos 2010-01-11 16:58:17 +00:00
rodzic af78f3465f
commit 5d3732cf3f
7 zmienionych plików z 389 dodań i 5 usunięć

Wyświetl plik

@ -2416,6 +2416,7 @@ static const char szBaudRates[] = "300|600|1200|2400|4800|9600|19200|38400|57600
tabsConfigure->color((Fl_Color)FL_LIGHT1);
tabsConfigure->selection_color((Fl_Color)FL_LIGHT1);
{ tabOperator = new Fl_Group(0, 25, 500, 345, _("Operator"));
tabOperator->tooltip(_("Operator information"));
tabOperator->callback((Fl_Callback*)cb_tabOperator);
tabOperator->when(FL_WHEN_CHANGED);
{ Fl_Group* o = new Fl_Group(5, 35, 490, 165, _("Station"));
@ -3938,6 +3939,7 @@ an merging"));
tabModems->end();
} // Fl_Group* tabModems
{ tabRig = new Fl_Group(0, 25, 500, 345, _("Rig"));
tabRig->tooltip(_("Transceiver control"));
tabRig->hide();
{ tabsRig = new Fl_Tabs(0, 25, 500, 345);
tabsRig->selection_color((Fl_Color)FL_LIGHT1);
@ -4326,6 +4328,7 @@ an merging"));
tabRig->end();
} // Fl_Group* tabRig
{ tabSoundCard = new Fl_Group(0, 25, 500, 345, _("Audio"));
tabSoundCard->tooltip(_("Audio devices"));
tabSoundCard->hide();
{ tabsSoundCard = new Fl_Tabs(0, 25, 500, 345);
tabsSoundCard->selection_color((Fl_Color)FL_LIGHT1);
@ -4842,6 +4845,7 @@ d frequency"));
tabMisc->end();
} // Fl_Group* tabMisc
{ tabQRZ = new Fl_Group(0, 25, 500, 345, _("Callsign DB"));
tabQRZ->tooltip(_("Callsign database"));
tabQRZ->hide();
{ Fl_Group* o = new Fl_Group(5, 180, 490, 75, _("CDROM"));
o->box(FL_ENGRAVED_FRAME);

Wyświetl plik

@ -88,7 +88,7 @@ static const char szBaudRates[] = "300|600|1200|2400|4800|9600|19200|38400|57600
code {} {}
Fl_Window {} {
label {Fldigi configuration} open
xywh {468 95 500 400} type Double color 45 selection_color 51 labelsize 18 align 80 visible
xywh {468 103 500 400} type Double color 45 selection_color 51 labelsize 18 align 80 visible
} {
Fl_Tabs tabsConfigure {open
xywh {-3 0 520 372} color 50 selection_color 50
@ -96,7 +96,7 @@ static const char szBaudRates[] = "300|600|1200|2400|4800|9600|19200|38400|57600
Fl_Group tabOperator {
label Operator
callback {progdefaults.changed = true;} open selected
xywh {0 25 500 345} when 1
tooltip {Operator information} xywh {0 25 500 345} when 1
} {
Fl_Group {} {
label Station open
@ -1662,7 +1662,7 @@ progdefaults.changed = true;}
}
Fl_Group tabRig {
label Rig open
xywh {0 25 500 345} hide
tooltip {Transceiver control} xywh {0 25 500 345} hide
} {
Fl_Tabs tabsRig {open
xywh {0 25 500 345} selection_color 50
@ -2222,7 +2222,7 @@ progdefaults.changed = true;}
}
Fl_Group tabSoundCard {
label Audio open
xywh {0 25 500 345} hide
tooltip {Audio devices} xywh {0 25 500 345} hide
} {
Fl_Tabs tabsSoundCard {open
xywh {0 25 500 345} selection_color 50
@ -2850,7 +2850,7 @@ progdefaults.changed = true;}
}
Fl_Group tabQRZ {
label {Callsign DB} open
xywh {0 25 500 345} hide
tooltip {Callsign database} xywh {0 25 500 345} hide
} {
Fl_Group {} {
label CDROM open

Wyświetl plik

@ -3,5 +3,6 @@
extern void create_new_macros();
extern void create_new_palettes();
extern void show_wizard(int argc = 0, char** argv = NULL);
#endif

Wyświetl plik

@ -51,6 +51,7 @@ extern const char *audio_card_icon[];
extern const char *help_about_icon[];
extern const char *insert_link_icon[];
extern const char *close_icon[];
extern const char *apply_icon[];
extern const char *enter_key_icon[];
extern const char *dialog_question_48_icon[];
extern const char *clear_sq_icon[];

Wyświetl plik

@ -173,6 +173,8 @@ double speed_test(int converter, unsigned repeat);
static void setup_signal_handlers(void);
static void checkdirectories(void);
#define SHOW_WIZARD_BEFORE_MAIN_WINDOW 1
int main(int argc, char ** argv)
{
appname = argv[0];
@ -333,6 +335,15 @@ int main(int argc, char ** argv)
progdefaults.initInterface();
#if SHOW_WIZARD_BEFORE_MAIN_WINDOW
if (!have_config) {
show_wizard(argc, argv);
Fl_Window* w;
while ((w = Fl::first_window()) && w->visible())
Fl::wait();
}
#endif
// OS X will prevent the main window from being resized if we change its
// size *after* it has been shown. With some X11 window managers, OTOH,
// the main window will not be restored at its exact saved position if
@ -363,6 +374,11 @@ int main(int argc, char ** argv)
notify_start();
mode_browser = new Mode_Browser;
#if !SHOW_WIZARD_BEFORE_MAIN_WINDOW
if (!have_config)
show_wizard();
#endif
int ret = Fl::run();
arq_close();

Wyświetl plik

@ -1,3 +1,27 @@
// ----------------------------------------------------------------------------
//
// newinstall.cxx
//
// Copyright (C) 2007-2009 Dave Freese, W1HKJ
// Copyright (C) 2009 Stelios Bounanos, M0GLD
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA.
//
// ----------------------------------------------------------------------------
#include <config.h>
#include "macros.h"
@ -289,3 +313,228 @@ void create_new_macros()
macros.saveMacros(Filename);
}
// =============================================================================
#include <vector>
#include <sstream>
#include <FL/Fl_Window.H>
#include <FL/Fl_Wizard.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Box.H>
#include <FL/fl_draw.H>
#include "configuration.h"
#include "confdialog.h"
#include "icons.h"
#include "gettext.h"
class Wizard : public Fl_Window
{
public:
struct wizard_tab {
Fl_Group* tab;
Fl_Group* parent;
int position;
int x, y, w, h;
};
Wizard(int w, int h, const char* l = 0)
: Fl_Window(w, h, l), pad(4)
{ create_wizard(); }
~Wizard() { destroy_wizard(); }
private:
void create_wizard(void);
Fl_Group* make_intro(void);
void destroy_wizard(void);
void place_buttons(void);
static void wizard_cb(Fl_Widget* w, void* arg);
int pad;
Fl_Wizard *wizard;
Fl_Button *cancel, *prev, *next, *done;
typedef vector<wizard_tab> tab_t;
tab_t tabs;
Fl_Group* header;
Fl_Box* title;
};
void Wizard::create_wizard(void)
{
callback(wizard_cb, this);
xclass(PACKAGE_TARNAME);
int btn_w = 100, btn_h = 22, icon_pad = 16;
wizard = new Fl_Wizard(0, 0, w(), h() - btn_h - 2 * pad);
wizard->end();
// create the buttons
fl_font(FL_HELVETICA, FL_NORMAL_SIZE);
struct {
Fl_Button** button;
const char* label;
int align;
} buttons[] = {
{ &done, make_icon_label(_("Finish"), apply_icon), FL_ALIGN_LEFT },
{ &next, make_icon_label(_("Next "), right_arrow_icon), FL_ALIGN_RIGHT },
{ &prev, make_icon_label(_("Back"), left_arrow_icon), FL_ALIGN_LEFT },
// { &cancel, make_icon_label(_("Cancel"), process_stop_icon), FL_ALIGN_LEFT }
{ &cancel, make_icon_label(_("Close"), close_icon), FL_ALIGN_LEFT }
};
for (size_t i = 0; i < sizeof(buttons)/sizeof(*buttons); i++) {
Fl_Button* b = *buttons[i].button = new Fl_Button(0, wizard->y() + wizard->h() + pad,
btn_w, btn_h, buttons[i].label);
b->callback(wizard_cb, this);
set_icon_label(b);
b->align(buttons[i].align | FL_ALIGN_INSIDE);
b->size(fl_width(get_icon_label_text(b)) + icon_pad * 2, b->h());
}
set_active(prev, false);
done->hide();
place_buttons();
end();
position(MAX(0, fl_digi_main->x() + (fl_digi_main->w() - w()) / 2),
MAX(0, fl_digi_main->y() + (fl_digi_main->h() - h()) / 2));
// populate the Fl_Wizard group
struct wizard_tab tabs_[] = {
{ NULL },
{ tabOperator },
{ tabSoundCard },
{ tabRig },
{ tabQRZ }
};
tabs.resize(sizeof(tabs_)/sizeof(*tabs_));
memcpy(&tabs[0], tabs_, sizeof(tabs_));
for (tab_t::iterator i = tabs.begin() + 1; i != tabs.end(); ++i) {
i->parent = i->tab->parent();
i->position = i->parent->find(i->tab);
i->x = i->tab->x();
i->y = i->tab->y();
i->w = i->tab->w();
i->h = i->tab->h();
}
tabs[0].tab = make_intro();
for (tab_t::iterator i = tabs.begin(); i != tabs.end(); ++i)
wizard->add(i->tab);
wizard->value(tabs[0].tab);
}
void Wizard::destroy_wizard(void)
{
// re-parent tabs
for (tab_t::const_iterator i = tabs.begin() + 1; i != tabs.end(); ++i) {
i->parent->insert(*i->tab, i->position);
i->tab->resize(i->x, i->y, i->w, i->h);
i->parent->init_sizes();
}
Fl_Button* b[] = { cancel, prev, next, done };
for (size_t i = 0; i < sizeof(b)/sizeof(*b); i++)
free_icon_label(b[i]);
header->parent()->remove(header);
delete header;
}
void Wizard::place_buttons(void)
{
Fl_Button* buttons[] = { next->visible() ? next : done, prev, cancel };
int x = wizard->x() + wizard->w();
for (size_t i = 0; i < sizeof(buttons)/sizeof(*buttons); i++) {
buttons[i]->position(x - buttons[i]->w() - pad, buttons[i]->y());
x = buttons[i]->x();
}
}
void Wizard::wizard_cb(Fl_Widget* w, void* arg)
{
Wizard* wiz = static_cast<Wizard*>(arg);
if (w == wiz || w == wiz->cancel || w == wiz->done) {
delete wiz;
return;
}
if (w == wiz->prev)
wiz->wizard->prev();
else if (w == wiz->next)
wiz->wizard->next();
Fl_Group* cur = static_cast<Fl_Group*>(wiz->wizard->value());
// insert header group in current tab, relabel title
cur->insert(*wiz->header, 0);
const char* text = cur->tooltip();
if (!text || !*text)
text = cur->label();
wiz->title->label(text);
// modify buttons
if (cur == wiz->tabs[0].tab)
set_active(wiz->prev, false);
else if (cur == wiz->tabs[1].tab)
set_active(wiz->prev, true);
else if (cur == wiz->tabs.back().tab) {
wiz->done->show();
wiz->next->hide();
wiz->place_buttons();
}
else {
wiz->done->hide();
wiz->next->show();
wiz->place_buttons();
}
}
Fl_Group* Wizard::make_intro(void)
{
int hdr_h = 20, ttl_w = 300, ttl_y = 2, hlp_h = 200;
Fl_Group* intro = new Fl_Group(wizard->x(), wizard->y(),
wizard->w(), wizard->h(), label());
header = new Fl_Group(0, 0, wizard->w(), hdr_h);
title = new Fl_Box(0, ttl_y, ttl_w, header->h());
title->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE);
title->labelfont(FL_HELVETICA_BOLD);
title->labelsize(FL_NORMAL_SIZE + 1);
title->label(intro->label());
header->end();
ostringstream help_;
help_ << '\n' << _("The wizard will guide you through the basic fldigi settings") << ":\n\n";
for (tab_t::const_iterator i = tabs.begin() + 1; i != tabs.end(); ++i)
help_ << "\t- " << i->tab->tooltip() << '\n';
help_ << '\n' << _("Feel free to skip any pages or exit the wizard at any time") << ". "
<< _("All settings shown here can be changed later via the Configure menu") << '.';
Fl_Box* help = new Fl_Box(pad, header->y() + header->h() + pad,
intro->w() - 2 * pad, hlp_h);
help->align(FL_ALIGN_TOP_LEFT | FL_ALIGN_INSIDE | FL_ALIGN_WRAP);
help->copy_label(help_.str().c_str());
intro->end();
return intro;
}
void show_wizard(int argc, char** argv)
{
Wizard* w = new Wizard(dlgConfig->w(), dlgConfig->h(), "Fldigi configuration wizard");
if (argc && argv)
w->show(argc, argv);
else {
w->show();
w->set_modal();
}
}

Wyświetl plik

@ -6289,6 +6289,119 @@ const char *close_icon[] = {
"TTTTTTTTTTTTTTTT"
};
// gtk apply icon
/* XPM */
const char *apply_icon[] = {
/* columns rows colors chars-per-pixel */
"16 16 88 1",
" c #498D07",
". c #498A0D",
"X c #519412",
"o c #529612",
"O c #559815",
"+ c #579B16",
"@ c #589B17",
"# c #579818",
"$ c #599C1B",
"% c #5A9D1B",
"& c #59991C",
"* c #5B9C1D",
"= c #5C9D1E",
"- c #5D9E1F",
"; c #5D9C21",
": c #5E9D22",
"> c #60A023",
", c #60A222",
"< c #66A52C",
"1 c #6AA92F",
"2 c #6AA730",
"3 c #6BA931",
"4 c #6FAB36",
"5 c #71AC38",
"6 c #74AF3A",
"7 c #74AE3D",
"8 c #75B13D",
"9 c #76B13E",
"0 c #7DB648",
"q c #7FB749",
"w c #8EE03E",
"e c #81B84D",
"r c #83B950",
"t c #88BF53",
"y c #89BE57",
"u c #95DF4D",
"i c #8CC259",
"p c #8FC55B",
"a c #91E145",
"s c #98E152",
"d c #99E054",
"f c #9BE355",
"g c #9DE25A",
"h c #9EE459",
"j c #A1E55E",
"k c #92C660",
"l c #93C661",
"z c #95C863",
"x c #96C965",
"c c #97C867",
"v c #9FD16F",
"b c #A1D073",
"n c #A1D372",
"m c #A4D475",
"M c #A6D777",
"N c #A7DC75",
"B c #A8DA77",
"V c #A6D678",
"C c #ABDB7C",
"Z c #ABDA7E",
"A c #ACDC7C",
"S c #A0E360",
"D c #A4E366",
"F c #A5E566",
"G c #A7E66A",
"H c #A7E26E",
"J c #A8E56C",
"K c #A7E868",
"L c #A9E470",
"P c #ABE672",
"I c #AFE877",
"U c #ADE279",
"Y c #ADE07A",
"T c #AEE47A",
"R c #B0E77B",
"E c #B3EB7D",
"W c #B4EB7C",
"Q c #ACD980",
"! c #ADDC80",
"~ c #AEDC81",
"^ c #B3E583",
"/ c #B3E187",
"( c #B4E684",
") c #B8EB87",
"_ c #BBE98E",
"` c #BCE990",
"' c #C2F094",
"] c None",
/* pixels */
"]]]]]]]]]]]->]]]",
"]]]]]]]]]]%bBq@]",
"]]]]]]]]]]yTGZ>]",
"]]]]]]]]]3AgHi]]",
"]]]]]]]]ocPdm#]]",
"]]]]]]]]7(uU5]]]",
"]] ]]]]&ZSFl]]]]",
"]5b0o]]iRsN<]]]]",
"%V'`z:4/fPe]]]]]",
"+p_W)Z~Ggv-]]]]]",
"]+e/EKjaU7]]]]]]",
"]]]2MIwFz]]]]]]]",
"]]]]*l^~:]]]]]]]",
"]]]]].81]]]]]]]]",
"]]]]]]]]]]]]]]]]",
"]]]]]]]]]]]]]]]]"
};
// enter key icon from KDE's crystal theme
/* XPM */