try that one on for size (VST build fu)
[ardour.git] / gtk2_ardour / option_editor.cc
index 86e7ff5473438ee41bc8fae647cdf0c7829297cb..3e461a85d7b475cad4ecaa169801d5c3cc8abff9 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2001 Paul Davis 
+    Copyright (C) 2001-2006 Paul Davis 
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 
 #include <pbd/whitespace.h>
 
+#include <ardour/audio_library.h>
 #include <ardour/session.h>
 #include <ardour/audioengine.h>
 #include <ardour/configuration.h>
 #include <ardour/auditioner.h>
+#include <ardour/destructive_filesource.h>
 #include <ardour/crossfade.h>
 #include <midi++/manager.h>
 #include <gtkmm2ext/stop_signal.h>
 #include "i18n.h"
 
 using namespace ARDOUR;
+using namespace PBD;
 using namespace Gtk;
 using namespace Editing;
 using namespace Gtkmm2ext;
 using namespace std;
 
-static const gchar *lmode_strings[] = {
-       N_("Later regions are higher"),
-       N_("Most recently added/moved/trimmed regions are higher"),
-       N_("Most recently added regions are higher"),
-       0
-};
-
-static const gchar *xfl_strings[] = {
-       N_("Span entire region overlap"),
-       N_("Short fades at the start of the overlap"),
-       0
-};
-
 static vector<string> positional_sync_strings;
-static vector<string> layer_mode_strings;
-static vector<string> xfade_model_strings;
 
 OptionEditor::OptionEditor (ARDOUR_UI& uip, PublicEditor& ed, Mixer_UI& mixui)
        : Dialog ("option editor"),
@@ -72,18 +60,14 @@ OptionEditor::OptionEditor (ARDOUR_UI& uip, PublicEditor& ed, Mixer_UI& mixui)
 
          /* Paths */
          path_table (11, 2),
-         sfdb_path_columns(),
-         sfdb_paths(ListStore::create(sfdb_path_columns)),
-         sfdb_path_view(sfdb_paths),
+         sfdb_path_view(),
 
          /* Fades */
 
-         auto_xfade_button (_("Automatically create crossfades")),
-         xfade_active_button (_("New full-overlap crossfades are unmuted")),
-         layer_mode_label (_("Region layering mode")),
-         xfade_model_label (_("Crossfade model")),
          short_xfade_adjustment (0, 1.0, 500.0, 5.0, 100.0),
          short_xfade_slider (short_xfade_adjustment),
+         destructo_xfade_adjustment (1.0, 1.0, 500.0, 1.0, 100.0),
+         destructo_xfade_slider (destructo_xfade_adjustment),
 
          /* Sync */
 
@@ -111,6 +95,7 @@ OptionEditor::OptionEditor (ARDOUR_UI& uip, PublicEditor& ed, Mixer_UI& mixui)
 
        click_io_selector = 0;
        auditioner_io_selector = 0;
+       session = 0;
 
        set_default_size (300, 300);
        set_title (_("ardour: options editor"));
@@ -119,9 +104,6 @@ OptionEditor::OptionEditor (ARDOUR_UI& uip, PublicEditor& ed, Mixer_UI& mixui)
        set_name ("OptionsWindow");
        add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK);
        
-       layer_mode_label.set_name ("OptionsLabel");
-       xfade_model_label.set_name ("OptionsLabel");
-       
        VBox *vbox = get_vbox();
        set_border_width (3);
 
@@ -170,8 +152,6 @@ OptionEditor::set_session (Session *s)
        click_emphasis_path_entry.set_sensitive (false);
        session_raid_entry.set_sensitive (false);
 
-       smpte_fps_combo.set_sensitive (false);
-       layer_mode_combo.set_sensitive (false);
        short_xfade_slider.set_sensitive (false);
        smpte_offset_negative_button.set_sensitive (false);
 
@@ -181,33 +161,12 @@ OptionEditor::set_session (Session *s)
                return;
        }
 
-
        click_path_entry.set_sensitive (true);
        click_emphasis_path_entry.set_sensitive (true);
        session_raid_entry.set_sensitive (true);
-       smpte_fps_combo.set_sensitive (true);
-       layer_mode_combo.set_sensitive (true);
        short_xfade_slider.set_sensitive (true);
        smpte_offset_negative_button.set_sensitive (true);
 
-       if (!s->smpte_drop_frames) {
-               // non-drop frames
-               if (s->smpte_frames_per_second == 24.0)
-                       smpte_fps_combo.set_active_text (_("24 FPS"));
-               else if (s->smpte_frames_per_second == 25.0)
-                       smpte_fps_combo.set_active_text (_("25 FPS"));
-               else if (s->smpte_frames_per_second == 30.0)
-                       smpte_fps_combo.set_active_text (_("30 FPS"));
-               else
-                       smpte_fps_combo.set_active_text (_("???"));
-       } else {
-               // drop frames
-               if (floor(s->smpte_frames_per_second) == 29.0)
-                       smpte_fps_combo.set_active_text (_("30 FPS drop"));
-               else
-                       smpte_fps_combo.set_active_text (_("???"));
-       }
-       
        smpte_offset_clock.set_session (s);
        smpte_offset_clock.set (s->smpte_offset (), true);
 
@@ -238,9 +197,6 @@ OptionEditor::set_session (Session *s)
        setup_click_editor ();
        connect_audition_editor ();
 
-       layer_mode_combo.set_active_text (layer_mode_strings[session->get_layer_model()]);
-       xfade_model_combo.set_active_text (xfade_model_strings[session->get_xfade_model()]);
-
        short_xfade_adjustment.set_value ((Crossfade::short_xfade_length() / (float) session->frame_rate()) * 1000.0);
 
        add_session_paths ();
@@ -250,12 +206,6 @@ OptionEditor::~OptionEditor ()
 {
 }
 
-static const gchar *native_format_strings[] = {
-       N_("Broadcast WAVE/floating point"),
-       N_("WAVE/floating point"),
-       0
-};
-
 void
 OptionEditor::setup_path_options()
 {
@@ -274,35 +224,23 @@ OptionEditor::setup_path_options()
        path_table.attach (*label, 0, 1, 0, 1, FILL|EXPAND, FILL);
        path_table.attach (session_raid_entry, 1, 3, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
 
-       label = manage(new Label(_("Native Format")));
-       label->set_name ("OptionsLabel");
-       path_table.attach (*label, 0, 1, 1, 2, FILL|EXPAND, FILL);
-       path_table.attach (native_format_combo, 1, 3, 1, 2, Gtk::FILL|Gtk::EXPAND, FILL);
-
        label = manage(new Label(_("Soundfile Search Paths")));
        label->set_name("OptionsLabel");
        path_table.attach(*label, 0, 1, 2, 3, FILL|EXPAND, FILL);
        path_table.attach(sfdb_path_view, 1, 3, 2, 3, Gtk::FILL|Gtk::EXPAND, FILL);
 
-       sfdb_path_view.append_column(_("Paths"), sfdb_path_columns.paths);
-       sfdb_path_view.set_size_request(-1, 100);
-
-       vector<string> nfstrings = internationalize (native_format_strings);
+       sfdb_path_view.set_paths(Library->get_paths());
+       sfdb_path_view.PathsUpdated.connect (mem_fun(*this, &OptionEditor::sfdb_paths_changed));
 
-       set_popdown_strings (native_format_combo, nfstrings);
-       native_format_combo.signal_changed().connect (mem_fun(*this, &OptionEditor::native_format_chosen));
-
-       fixup_combo_size (native_format_combo, nfstrings);
-
-       if (Config->get_native_format_is_bwf()) {
-               native_format_combo.set_active_text (native_format_strings[0]);
-       } else {
-               native_format_combo.set_active_text (native_format_strings[1]);
-       }
-       
        path_table.show_all();
 }
 
+void
+OptionEditor::sfdb_paths_changed ()
+{
+       Library->set_paths (sfdb_path_view.get_paths());
+}
+
 void
 OptionEditor::add_session_paths ()
 {
@@ -310,16 +248,16 @@ OptionEditor::add_session_paths ()
        click_emphasis_path_entry.set_sensitive (true);
        session_raid_entry.set_sensitive (true);
 
-       if (session->click_sound.length() == 0) {
+       if (Config->get_click_sound().empty()) {
                click_path_entry.set_text (_("internal"));
        } else {
-               click_path_entry.set_text (session->click_sound);
+               click_path_entry.set_text (Config->get_click_sound());
        }
 
-       if (session->click_emphasis_sound.length() == 0) {
+       if (Config->get_click_emphasis_sound().empty()) {
                click_emphasis_path_entry.set_text (_("internal"));
        } else {
-               click_emphasis_path_entry.set_text (session->click_emphasis_sound);
+               click_emphasis_path_entry.set_text (Config->get_click_emphasis_sound());
        }
 
        session_raid_entry.set_text(session->raid_path());
@@ -329,74 +267,35 @@ void
 OptionEditor::setup_fade_options ()
 {
        Gtk::HBox* hbox;
-       vector<string> dumb;
        
-       auto_xfade_button.set_name ("OptionEditorToggleButton");
-       xfade_active_button.set_name ("OptionEditorToggleButton");
-
-       hbox = manage (new HBox);
-       hbox->set_border_width (12);
-       hbox->pack_start (auto_xfade_button, false, false);
-       fade_packer.pack_start (*hbox, false, false);
-
-       hbox = manage (new HBox);
-       hbox->set_border_width (12);
-       hbox->pack_start (xfade_active_button, false, false);
-       fade_packer.pack_start (*hbox, false, false);
-
-       layer_mode_strings = internationalize (lmode_strings);
-
-       dumb.push_back (lmode_strings[Session::LaterHigher]);
-       dumb.push_back (lmode_strings[Session::MoveAddHigher]);
-       dumb.push_back (lmode_strings[Session::AddHigher]);
-       set_popdown_strings (layer_mode_combo, dumb);
-
-       layer_mode_combo.signal_changed ().connect (mem_fun(*this, &OptionEditor::layer_mode_chosen));
-
-       fixup_combo_size (layer_mode_combo, layer_mode_strings);
-
-       hbox = manage (new HBox);
-       hbox->set_border_width (5);
-       hbox->set_spacing (10);
-       hbox->pack_start (layer_mode_label, false, false);
-       hbox->pack_start (layer_mode_combo, false, false);
-       fade_packer.pack_start (*hbox, false, false);
-
-       xfade_model_strings = internationalize (xfl_strings);
-
-       dumb.clear ();
-       dumb.push_back (xfade_model_strings[FullCrossfade]);
-       dumb.push_back (xfade_model_strings[ShortCrossfade]);
-       set_popdown_strings (xfade_model_combo, dumb);
-
-       xfade_model_combo.signal_changed().connect (mem_fun(*this, &OptionEditor::xfade_model_chosen));
-
-       fixup_combo_size (xfade_model_combo, xfade_model_strings);
-
+       Label* label = manage (new Label (_("Short crossfade length (msecs)")));
+       label->set_name ("OptionsLabel");
+       
        hbox = manage (new HBox);
        hbox->set_border_width (5);
        hbox->set_spacing (10);
-       hbox->pack_start (xfade_model_label, false, false);
-       hbox->pack_start (xfade_model_combo, false, false);
+       hbox->pack_start (*label, false, false);
+       hbox->pack_start (short_xfade_slider, true, true);
        fade_packer.pack_start (*hbox, false, false);
 
-       auto_xfade_button.set_active (Config->get_auto_xfade());
-       /* xfade and layer mode active requires session */
+       short_xfade_adjustment.signal_value_changed().connect (mem_fun(*this, &OptionEditor::short_xfade_adjustment_changed));
 
-       auto_xfade_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::auto_xfade_clicked));
-       xfade_active_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::xfade_active_clicked));
-       
-       Label* short_xfade_label = manage (new Label (_("Short crossfade length (msecs)")));
-       short_xfade_label->set_name ("OptionsLabel");
+       label = manage (new Label (_("Destructive crossfade length (msecs)")));
+       label->set_name ("OptionsLabel");
        
        hbox = manage (new HBox);
        hbox->set_border_width (5);
        hbox->set_spacing (10);
-       hbox->pack_start (*short_xfade_label, false, false);
-       hbox->pack_start (short_xfade_slider, true, true);
+       hbox->pack_start (*label, false, false);
+       hbox->pack_start (destructo_xfade_slider, true, true);
        fade_packer.pack_start (*hbox, false, false);
+       
+       destructo_xfade_adjustment.signal_value_changed().connect (mem_fun(*this, &OptionEditor::destructo_xfade_adjustment_changed));
 
-       short_xfade_adjustment.signal_value_changed().connect (mem_fun(*this, &OptionEditor::short_xfade_adjustment_changed));
+       short_xfade_slider.set_update_policy (UPDATE_DISCONTINUOUS);
+       destructo_xfade_slider.set_update_policy (UPDATE_DISCONTINUOUS);
+
+       destructo_xfade_adjustment.set_value (Config->get_destructive_xfade_msecs());
 
        fade_packer.show_all ();
 }
@@ -409,56 +308,23 @@ OptionEditor::short_xfade_adjustment_changed ()
                
                /* val is in msecs */
                
-               Crossfade::set_short_xfade_length ((jack_nframes_t) floor (session->frame_rate() * (val / 1000.0)));
+               Crossfade::set_short_xfade_length ((nframes_t) floor (session->frame_rate() * (val / 1000.0)));
        }
 }
 
 void
-OptionEditor::layer_mode_chosen ()
+OptionEditor::destructo_xfade_adjustment_changed ()
 {
-       if (!session) {
-               return;
-       }
+       float val = destructo_xfade_adjustment.get_value();
 
-       string which = layer_mode_combo.get_active_text ();
+       /* val is in msecs */
 
-       if (which == layer_mode_strings[Session::LaterHigher]) {
-               session->set_layer_model (Session::LaterHigher);
-       } else if (which == layer_mode_strings[Session::MoveAddHigher]) {
-               session->set_layer_model (Session::MoveAddHigher);
-       } else if (which == layer_mode_strings[Session::AddHigher]) {
-               session->set_layer_model (Session::AddHigher);
-       }
-}
-
-void
-OptionEditor::xfade_model_chosen ()
-{
-       if (!session) {
-               return;
-       }
-
-       string which = xfade_model_combo.get_active_text ();
-
-       if (which == xfade_model_strings[FullCrossfade]) {
-               session->set_xfade_model (FullCrossfade);
-       } else if (which == xfade_model_strings[ShortCrossfade]) {
-               session->set_xfade_model (ShortCrossfade);
-       }
-}
-
-void
-OptionEditor::auto_xfade_clicked ()
-{
-       Config->set_auto_xfade (auto_xfade_button.get_active());
-}
+       
+       Config->set_destructive_xfade_msecs ((uint32_t) floor (val));
 
-void
-OptionEditor::xfade_active_clicked ()
-{
        if (session) {
-               session->set_crossfades_active (xfade_active_button.get_active());
-       }
+               SndFileSource::setup_standard_crossfades (session->frame_rate());
+       } 
 }
 
 void
@@ -467,15 +333,6 @@ OptionEditor::setup_sync_options ()
        HBox* hbox;
        vector<string> dumb;
 
-       dumb.clear ();
-       dumb.push_back (X_("24 FPS"));
-       dumb.push_back (X_("25 FPS"));
-       dumb.push_back (X_("30 FPS drop"));
-       dumb.push_back (X_("30 FPS non-drop"));
-       
-       set_popdown_strings (smpte_fps_combo, dumb);
-       smpte_fps_combo.signal_changed().connect (mem_fun(*this, &OptionEditor::smpte_fps_chosen));
-       
        smpte_offset_clock.set_mode (AudioClock::SMPTE);
        smpte_offset_clock.ValueChanged.connect (mem_fun(*this, &OptionEditor::smpte_offset_chosen));
        
@@ -483,19 +340,9 @@ OptionEditor::setup_sync_options ()
 
        smpte_offset_negative_button.unset_flags (Gtk::CAN_FOCUS);
 
-       Label *smpte_fps_label = manage (new Label (_("SMPTE Frames/second")));
        Label *smpte_offset_label = manage (new Label (_("SMPTE Offset")));
-       smpte_fps_label->set_name("OptionsLabel");
        smpte_offset_label->set_name("OptionsLabel");
        
-       hbox = manage (new HBox);
-       hbox->set_border_width (5);
-       hbox->set_spacing (10);
-       hbox->pack_start (*smpte_fps_label, false, false);
-       hbox->pack_start (smpte_fps_combo, false, false);
-
-       sync_packer.pack_start (*hbox, false, false);
-
        hbox = manage (new HBox);
        hbox->set_border_width (5);
        hbox->set_spacing (10);
@@ -516,29 +363,11 @@ OptionEditor::smpte_offset_negative_clicked ()
        }
 }
 
-void
-OptionEditor::smpte_fps_chosen ()
-{
-       if (session) {
-               string str = smpte_fps_combo.get_active_text();
-               
-               if (str == X_("24 FPS")) {
-                       session->set_smpte_type (24.0, false);
-               } else if (str == X_("25 FPS")) {
-                       session->set_smpte_type (25.0, false);
-               } else if (str == X_("30 FPS drop")) {
-                       session->set_smpte_type (29.97, true);
-               } else if (str == X_("30 FPS non-drop")) {
-                       session->set_smpte_type (30.0, false);
-               }
-       }
-}
-
 void
 OptionEditor::smpte_offset_chosen()
 {
        if (session) {
-               jack_nframes_t frames = smpte_offset_clock.current_duration();
+               nframes_t frames = smpte_offset_clock.current_duration();
                session->set_smpte_offset (frames);
        }
 }
@@ -592,19 +421,19 @@ OptionEditor::setup_midi_options ()
                }
 
                tb->set_active (!(*i).second->input()->offline());
-               tb->signal_button_press_event().connect (bind (mem_fun(*this, &OptionEditor::port_online_toggled), (*i).second, tb));
+               tb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::port_online_toggled), (*i).second, tb));
                (*i).second->input()->OfflineStatusChanged.connect (bind (mem_fun(*this, &OptionEditor::map_port_online), (*i).second, tb));
                table->attach (*tb, 1, 2, n+2, n+3, FILL|EXPAND, FILL);
 
                tb = manage (new ToggleButton ());
                tb->set_name ("OptionEditorToggleButton");
-               tb->signal_button_press_event().connect (bind (mem_fun(*this, &OptionEditor::port_trace_in_toggled), (*i).second, tb));
+               tb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::port_trace_in_toggled), (*i).second, tb));
                tb->set_size_request (10, 10);
                table->attach (*tb, 2, 3, n+2, n+3, FILL|EXPAND, FILL);
 
                tb = manage (new ToggleButton ());
                tb->set_name ("OptionEditorToggleButton");
-               tb->signal_button_press_event().connect (bind (mem_fun(*this, &OptionEditor::port_trace_out_toggled), (*i).second, tb));
+               tb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::port_trace_out_toggled), (*i).second, tb));
                tb->set_size_request (10, 10);
                table->attach (*tb, 3, 4, n+2, n+3, FILL|EXPAND, FILL);
 
@@ -716,47 +545,46 @@ OptionEditor::midi_port_chosen (MIDI::Port* port, Gtk::RadioButton* rb)
        }
 }
 
-gint
-OptionEditor::port_online_toggled (GdkEventButton* ev, MIDI::Port* port, ToggleButton* tb)
+void
+OptionEditor::port_online_toggled (MIDI::Port* port, ToggleButton* tb)
 {
-       bool wanted = tb->get_active(); /* it hasn't changed at this point */
-
+       bool wanted = tb->get_active();
+       
        if (wanted != port->input()->offline()) {
                port->input()->set_offline (wanted);
        } 
-       return stop_signal (*tb, "button_press_event");
 }
 
 void
 OptionEditor::map_port_online (MIDI::Port* port, ToggleButton* tb)
 {
        if (port->input()->offline()) {
-               static_cast<Label*>(tb->get_child())->set_text (_("offline"));
+               tb->set_label (_("offline"));
                tb->set_active (false);
        } else {
-               static_cast<Label*>(tb->get_child())->set_text (_("online"));
+               tb->set_label (_("online"));
                tb->set_active (true);
        }
 }
 
-gint
-OptionEditor::port_trace_in_toggled (GdkEventButton* ev, MIDI::Port* port, ToggleButton* tb)
+void
+OptionEditor::port_trace_in_toggled (MIDI::Port* port, ToggleButton* tb)
 {
-       /* XXX not very good MVC style here */
+       bool trace = tb->get_active();
 
-       port->input()->trace (!tb->get_active(), &cerr, string (port->name()) + string (" input: "));
-       tb->set_active (!tb->get_active());
-       return stop_signal (*tb, "button_press_event");
+       if (port->input()->tracing() != trace) {
+               port->output()->trace (trace, &cerr, string (port->name()) + string (" input: "));
+       }
 }
 
-gint
-OptionEditor::port_trace_out_toggled (GdkEventButton* ev,MIDI::Port* port, ToggleButton* tb)
+void
+OptionEditor::port_trace_out_toggled (MIDI::Port* port, ToggleButton* tb)
 {
-       /* XXX not very good MVC style here */
+       bool trace = tb->get_active();
 
-       port->output()->trace (!tb->get_active(), &cerr, string (port->name()) + string (" output: "));
-       tb->set_active (!tb->get_active());
-       return stop_signal (*tb, "button_press_event");
+       if (port->output()->tracing() != trace) {
+               port->output()->trace (trace, &cerr, string (port->name()) + string (" output: "));
+       }
 }
 
 void
@@ -779,14 +607,14 @@ void
 OptionEditor::raid_path_changed ()
 {
        if (session) {
-               session->set_raid_path (session_raid_entry.get_text());
+               Config->set_raid_path (session_raid_entry.get_text());
        }
 }
 
 void
 OptionEditor::click_browse_clicked ()
 {
-       SoundFileChooser sfdb (_("Choose Click"));
+       SoundFileChooser sfdb (_("Choose Click"), session);
        
        int result = sfdb.run ();
 
@@ -805,7 +633,7 @@ OptionEditor::click_chosen (const string & path)
 void
 OptionEditor::click_emphasis_browse_clicked ()
 {
-       SoundFileChooser sfdb (_("Choose Click Emphasis"));
+       SoundFileChooser sfdb (_("Choose Click Emphasis"), session);
 
        int result = sfdb.run ();
 
@@ -827,22 +655,22 @@ OptionEditor::click_sound_changed ()
        if (session) {
                string path = click_path_entry.get_text();
 
-               if (path == session->click_sound) {
+               if (path == Config->get_click_sound()) {
                        return;
                }
 
-               if (path.length() == 0) {
+               if (path.empty()) {
 
-                       session->set_click_sound ("");
+                       Config->set_click_sound ("");
 
                } else {
 
                        strip_whitespace_edges (path);
                        
                        if (path == _("internal")) {
-                               session->set_click_sound ("");
+                               Config->set_click_sound ("");
                        } else {
-                               session->set_click_sound (path);
+                               Config->set_click_sound (path);
                        }
                }
        }
@@ -854,44 +682,27 @@ OptionEditor::click_emphasis_sound_changed ()
        if (session) {
                string path = click_emphasis_path_entry.get_text();
 
-               if (path == session->click_emphasis_sound) {
+               if (path == Config->get_click_emphasis_sound()) {
                        return;
                }
 
-               if (path.length() == 0) {
+               if (path.empty()) {
 
-                       session->set_click_emphasis_sound ("");
+                       Config->set_click_emphasis_sound ("");
 
                } else {
 
                        strip_whitespace_edges (path);
 
                        if (path == _("internal")) {
-                               session->set_click_emphasis_sound ("");
+                               Config->set_click_emphasis_sound ("");
                        } else {
-                               session->set_click_emphasis_sound (path);
+                               Config->set_click_emphasis_sound (path);
                        }
                }
        }
 }
 
-void
-OptionEditor::native_format_chosen ()
-{
-       string which;
-
-       if (session == 0) {
-               return;
-       }
-
-       bool use_bwf = (native_format_combo.get_active_text() == native_format_strings[0]);
-
-       if (use_bwf != Config->get_native_format_is_bwf()) {
-               Config->set_native_format_is_bwf (use_bwf);
-               session->reset_native_file_format ();
-       }
-}
-
 void
 OptionEditor::clear_click_editor ()
 {