Пример #1
0
Application_Message_Dialog::Application_Message_Dialog() :
    Dialog("Messages"),
    _show        (true),
    _widget      (0),
    _show_widget (0),
    _clear_widget(0),
    _close_widget(0)
{
    // Create widgets.

    _widget = new Multiline_Text_Display;

    _show_widget = new Check_Button("&Show");

    _clear_widget = new Push_Button("&Clear");

    _close_widget = new Push_Button("Clos&e");

    // Layout.

    Vertical_Layout * layout = new Vertical_Layout(this);
    layout->add(_widget);
    layout->stretch(_widget);

    Horizontal_Layout * layout_h = new Horizontal_Layout(layout);
    layout_h->margin(0);
    layout_h->add(_show_widget);
    layout_h->add_stretch();
    layout_h->add(_clear_widget);
    layout_h->add(_close_widget);
    layout_h->add_spacer(Layout::window_handle_size());

    // Preferences.

    Prefs prefs(Prefs::prefs_global(), "application_message_dialog");
    Prefs::get_(&prefs, "show", &_show);

    // Initialize.

    widget_update();
    dialog_update();

    size(size_hint());

    // Callbacks.

    _show_widget->signal.set(this, show_callback);
    _clear_widget->signal.set(this, clear_callback);
    _close_widget->signal.set(this, close_callback);
}
Пример #2
0
Magnify_Dialog::Magnify_Dialog() :
    Dialog("Magnify"),
    _view        (0),
    _zoom        (ZOOM_200),
    _widget      (0),
    _zoom_widget (0),
    _close_widget(0)
{
    // Create widgets.

    _widget = new Magnify_Widget;

    _zoom_widget = new Choice_Widget(label_zoom());

    _close_widget = new Push_Button(label_close);

    // Layout.

    Vertical_Layout * layout = new Vertical_Layout(this);

    layout->add(_widget);
    layout->stretch(_widget);

    Horizontal_Layout * layout_h = new Horizontal_Layout(layout);
    layout_h->margin(0);
    layout_h->add(_zoom_widget);
    layout_h->add_spacer(-1, true);
    layout_h->add(_close_widget);
    layout_h->add_spacer(Layout::window_handle_size());

    // Preferences.

    Prefs prefs(Prefs::prefs(), "magnify_dialog");
    Prefs::get_(&prefs, "zoom", &_zoom);

    // Initialize.

    widget_update();

    size(Vector_Util::max(size_hint(), V2i(300, 300)));

    // Callbacks.

    _zoom_widget->signal.set(this, zoom_callback);

    _close_widget->signal.set(this, close_callback);
}
Пример #3
0
Multi_Choice_Dialog::Multi_Choice_Dialog(
    const String & label,
    const List<String> & list) :
    Abstract_Message_Dialog(label_multi_choice),
    signal      (this),
    index_signal(this),
    _widget     (0),
    _label      (0)
{
    // Create widgets.

    _widget = new Check_Button_Group(list);
    _widget->align(CENTER, CENTER);

    _label = new Label(label);

    Push_Button * ok_button = new Push_Button(label_ok);
    Push_Button * close_button = new Push_Button(label_close);

    // Layout.

    Vertical_Layout * layout = new Vertical_Layout(this);

    Vertical_Layout * layout_v = new Vertical_Layout(layout);
    layout->stretch(layout_v);
    layout_v->margin(Style::global()->margin_large());
    layout_v->add(_label);
    layout_v->add(_widget);
    layout_v->stretch(_widget);

    Horizontal_Layout * layout_h = new Horizontal_Layout(layout);
    layout_h->margin(0);
    layout_h->add_stretch();
    layout_h->add(ok_button);
    layout_h->add(close_button);
    layout_h->add_spacer(Layout::window_handle_size());

    // Initialize.

    size(size_hint(), false);

    // Callbacks.

    ok_button->signal.set(this, ok_callback);
    close_button->signal.set(this, close_callback);
}
Пример #4
0
Application::Application(int argc, char ** argv) :
    djv::Application("djv_play2_test", argc, argv),
    _frame(0),
    _image0(0),
    _image1(0),
    _window(0)
{
    File::seq_extensions.add(List<String>() << ".ppm" << ".PPM");

    // Command line.

    if (argc != 2)
    {
        print("usage: test_image_play2 (input)");
        exit(EXIT_ERROR);
        return;
    }

    _file.set(argv[1]);

    if (_file.is_seq_valid())
    {
        _file.type(File::SEQ);
    }

    is_valid(true);

    // Widgets.

    _window = new djv::Window(name());

    _widget = new Widget;

    // Layout.

    Vertical_Layout * layout = new Vertical_Layout(_window);
    layout->margin(0);
    layout->add(_widget);
    layout->stretch(_widget);

    // Initialize.

    _image_buf.resize(20);
    List<Image_Ptr>::size_type i = 0;

    for (; i < _image_buf.size(); ++i)
    {
        _image_buf[i].p = new Image_Ppm;
    }

    i = 0;

    for (; i < _image_buf.size() - 1; ++i)
    {
        _image_buf[i].next = &_image_buf[i + 1];
    }

    _image_buf[i].next = &_image_buf[0];

    _image0 = &_image_buf[0];
    _image0->p->load(_file.get(_file.seq().list[_frame]));
    _image0->frame = _frame;

    _image1 = &_image_buf[0];

    //update();
    Fl::add_idle(update_callback, this);

    _window->size(_image0->p->info().size);
    _window->show();

    // Callbacks.

    _window->close_signal.set(this, exit_callback);
}
Пример #5
0
Application::Application(int argc, char ** argv) :
    djv::Application("djv_play_test", argc, argv),
    _load  (0),
    _window(0),
    _frame (0)
{
    // Command line.

    if (argc != 2)
    {
        print("usage: djv_play_test (input)");
        exit(EXIT_ERROR);
        return;
    }

    _file.set(argv[1]);

    if (_file.is_seq_valid())
    {
        _file.type(File::SEQ);
    }

    try
    {
        _load = Image_Load_Factory::global()->get(_file, &_info);
    }
    catch (Error error)
    {
        this->error(error);
        exit(EXIT_ERROR);
        return;
    }

    is_valid(true);

    // Widgets.

    _window = new djv::Window(name());

    _widget = new Widget;

    // Layout.

    Vertical_Layout * layout = new Vertical_Layout(_window);
    layout->margin(0);
    layout->add(_widget);
    layout->stretch(_widget);

    // Initialize.

    //update();
    Fl::add_idle(update_callback, this);

    //_widget->zoom(0.5);

    _window->size(_info.size);
    _window->show();

    // Callbacks.

    _window->close_signal.set(this, exit_callback);
}