~ubuntu-branches/ubuntu/oneiric/toonloop/oneiric

« back to all changes in this revision

Viewing changes to src/gui.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jean-Louis Dupond
  • Date: 2011-05-03 10:30:43 UTC
  • mfrom: (2.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20110503103043-4kwpbs1a9o2d7wu0
Tags: 2.0.6-1ubuntu1
* Merge toonloop (2.0.6-1) from Debian unstable (LP: #775588).
* Remaining changes:
  - debian/patches/fix-depend.patch: replace libclutter-gst-0.10-dev with
    libclutter-gst-dev
  - debian/rules: add CPPFLAGS to build correctly

Show diffs side-by-side

added added

removed removed

Lines of Context:
164
164
    // TODO:2010-09-18:aalex:Use the accelerators to allow the user to configure the controls
165
165
    // TODO:2010-09-18:aalex:Use Clutter for mouse and keyboard controls (ClutterBindingPool)
166
166
    Gui *context = static_cast<Gui*>(user_data);
 
167
    bool verbose = context->owner_->get_configuration()->get_verbose();
167
168
 
168
169
    switch (event->keyval)
169
170
    {
258
259
            // (if there is one)
259
260
            if (event->state & GDK_CONTROL_MASK)
260
261
            {
261
 
                g_print("Ctrl-Q key pressed, quitting.\n");
 
262
                if (verbose)
 
263
                    g_print("Ctrl-Q key pressed, quitting.\n");
262
264
                context->owner_->quit();
263
265
            }
264
266
            break;
267
269
            // (if there is one)
268
270
            if (event->state & GDK_CONTROL_MASK)
269
271
            {
270
 
                g_print("Ctrl-S key pressed, TODO: save the whole project.\n");
 
272
                if (verbose)
 
273
                    g_print("Ctrl-S key pressed, TODO: save the whole project.\n");
271
274
                // For now, we save the clip anyways
272
275
                context->owner_->get_controller()->save_current_clip();
273
276
            } else // no Ctrl pressed
318
321
            }
319
322
            break;
320
323
        case GDK_i:
321
 
            context->enable_hud_ = ! context->enable_hud_;
322
 
            if (context->enable_hud_)
323
 
                clutter_actor_show(context->info_text_actor_);
324
 
            else
325
 
                clutter_actor_hide(context->info_text_actor_);
 
324
            context->toggle_info();
 
325
            break;
 
326
        case GDK_F1:
 
327
            context->toggle_help();
326
328
            break;
327
329
        case GDK_o:
328
330
            context->enable_onionskin( ! context->onionskin_enabled_);
333
335
    return TRUE;
334
336
}
335
337
/**
 
338
 * Toggles the visibility of the info text.
 
339
 */
 
340
void Gui::toggle_info()
 
341
{
 
342
    enable_info_ = ! enable_info_;
 
343
    if (enable_info_)
 
344
        clutter_actor_show(info_text_actor_);
 
345
    else
 
346
        clutter_actor_hide(info_text_actor_);
 
347
}
 
348
/**
 
349
 * Toggles the visibility of the info text.
 
350
 */
 
351
void Gui::toggle_help()
 
352
{
 
353
    enable_help_ = ! enable_help_;
 
354
    if (enable_help_)
 
355
        clutter_actor_show(help_text_actor_);
 
356
    else
 
357
        clutter_actor_hide(help_text_actor_);
 
358
}
 
359
 
 
360
/**
336
361
 * Called when the window is deleted. Quits the application.
337
362
 */
338
363
void Gui::on_delete_event(GtkWidget* /*widget*/, GdkEvent* /*event*/, gpointer user_data)
718
743
    overlay_opacity_(50),
719
744
    onionskin_opacity_(50),
720
745
    onionskin_enabled_(false),
721
 
    enable_hud_(false),
 
746
    enable_info_(false),
 
747
    enable_help_(false),
722
748
    fade_duration_ratio_(0.0)
723
749
{
724
750
    //video_xwindow_id_ = 0;
827
853
    clutter_container_add_actor(CLUTTER_CONTAINER(stage_), CLUTTER_ACTOR(live_input_texture_));
828
854
    clutter_actor_hide_all(CLUTTER_ACTOR(live_input_texture_));
829
855
    
830
 
    // TEXT
831
 
    info_text_actor_ = clutter_text_new_full("", "Sans 16px", clutter_color_new(255, 255, 255, 255));
832
 
    //update_info_text();
 
856
    // INFO TEXT
 
857
    info_text_actor_ = clutter_text_new_full("Sans 16px", "", clutter_color_new(255, 255, 255, 255));
833
858
    clutter_container_add_actor(CLUTTER_CONTAINER(stage_), CLUTTER_ACTOR(info_text_actor_));
 
859
    // HELP TEXT
 
860
    std::string HELP_TEXT(INTERACTIVE_HELP + "(Press F1 to hide)");
 
861
    help_text_actor_ = clutter_text_new_full("Sans 12px", HELP_TEXT.c_str(), clutter_color_new(255, 255, 255, 255));
 
862
    clutter_container_add_actor(CLUTTER_CONTAINER(stage_), CLUTTER_ACTOR(help_text_actor_));
834
863
    // Sort actors and groups:
835
864
    clutter_container_raise_child(CLUTTER_CONTAINER(stage_), CLUTTER_ACTOR(playback_group_), NULL);
836
865
    clutter_container_raise_child(CLUTTER_CONTAINER(stage_), CLUTTER_ACTOR(onionskin_group_), NULL);
845
874
    // Set visibility for other things
846
875
    enable_onionskin(false); // hides it
847
876
    clutter_actor_hide(info_text_actor_);
 
877
    clutter_actor_hide(help_text_actor_);
848
878
    // shown when we get first live image size, and we play the first image
849
879
    clutter_actor_hide(live_input_texture_); 
850
880
    clutter_actor_hide_all(CLUTTER_ACTOR(playback_group_));
857
887
{
858
888
    std::ostringstream os;
859
889
    Clip* current_clip = owner_->get_current_clip();
860
 
    os << "Toonloop " << PACKAGE_VERSION << std::endl;
 
890
    os << "Toonloop " << PACKAGE_VERSION << " info (press i to hide)" << std::endl;
861
891
    os << "Current clip: " << current_clip->get_id() << std::endl;
862
892
    os << "FPS: " << current_clip->get_playhead_fps() << std::endl;
863
893
    os << "Playhead: " << current_clip->get_playhead() << std::endl;
881
911
 
882
912
Gui::~Gui()
883
913
{
884
 
    std::cout << "~Gui" << std::endl;
 
914
    //std::cout << "~Gui" << std::endl;
885
915
    //TODO:
886
916
    //for (ActorIterator iter = playback_textures_.begin(); iter != playback_textures_.end(); ++iter)
887
917
    //    //iter->