예제 #1
0
static gboolean on_editor_notify(G_GNUC_UNUSED GObject *obj, GeanyEditor *editor,
	SCNotification *nt, G_GNUC_UNUSED gpointer gdata)
{
	if (nt->nmhdr.code == SCN_MODIFIED)
	{
		if (nt->modificationType & SC_MOD_INSERTTEXT)
		{
			if (nt->position < select_anchor)
			{
				select_anchor += nt->length;
				select_space = 0;
				save_selection(editor->sci);
			}
		}
		else if (nt->modificationType & SC_MOD_DELETETEXT)
		{
			if (nt->position < select_anchor)
			{
				if (nt->position + nt->length < select_anchor)
					select_anchor -= nt->length;
				else
					select_anchor = nt->position;
				select_space = 0;
				save_selection(editor->sci);
			}
		}
	}

	return FALSE;
}
void
additional_parts_dialog::on_sort(wxCommandEvent &) {
  save_selection([&]() {
      mtx::sort::naturally(m_files.begin(), m_files.end());
      repopulate();
    });
}
예제 #3
0
static void on_set_anchor_activate(G_GNUC_UNUSED GtkMenuItem *menuitem,
	G_GNUC_UNUSED gpointer gdata)
{
	ScintillaObject *sci = scintilla_get_current();

	if (sci)
	{
		select_anchor = sci_get_current_position(sci);
		select_space = sci_get_cursor_space(sci);
		save_selection(sci);
	}
}
void MainWindow::setup_connections()
{
    //connect buttons for choosing colors for distribution visualization
    connect(ui.chooseColorButton1, SIGNAL(clicked()), this, SLOT(choose_color_1()));
    connect(ui.chooseColorButton2, SIGNAL(clicked()), this, SLOT(choose_color_2()));

    //connect button for load distributions from file
    connect(ui.loadButton, SIGNAL(clicked()), this, SLOT(load()));

    //connect button for load regret matrix
//    connect(ui.loadRegretMatrixPushButton, SIGNAL(clicked()), this, SLOT(load_regret_matrix()));

    //connect button for saving selection
    connect(ui.buttonSaveSelection, SIGNAL(clicked()), this, SLOT(save_selection()));

    //connect button for generate selection
    connect(ui.generateButton, SIGNAL(clicked()), this, SLOT(generate()));

    //connect button for recognizing
    connect(ui.recognizeButton, SIGNAL(clicked()), this, SLOT(recognize()));

    //connect button for calculate values
    connect(ui.drawButton, SIGNAL(clicked()), this, SLOT(calculate_values()));
    connect(ui.component1, SIGNAL(editingFinished()), this, SLOT(calculate_values()));
    connect(ui.component2, SIGNAL(editingFinished()), this, SLOT(calculate_values()));

    //connect zoom sliders
    connect(ui.zoomX, SIGNAL(valueChanged(int)), this, SLOT(draw()));
    connect(ui.zoomY, SIGNAL(valueChanged(int)), this, SLOT(draw()));

    //connect checkboxes
    connect(ui.checkBoxDrawAxises, SIGNAL(clicked()), this, SLOT(draw()));
    connect(ui.checkBoxDrawReal, SIGNAL(clicked()), this, SLOT(draw()));
    connect(ui.checkBoxIsolines, SIGNAL(clicked()), this, SLOT(draw()));
    connect(ui.checkBoxMiddle, SIGNAL(clicked()), this, SLOT(draw()));
    connect(ui.checkBoxRecognized, SIGNAL(clicked()), this, SLOT(draw()));
    connect(ui.checkBoxSelection, SIGNAL(clicked()), this, SLOT(draw()));

    //connect button click action to transformationMatrixDialog show action
    connect(ui.transformationButton, SIGNAL(clicked()), this, SLOT(show_transformation_matrix()));
    connect(ui.showCorrelationMatrixPushButton1, SIGNAL(clicked()), this, SLOT(show_matrix_of_correlations1()));
    connect(ui.showCorrelationMatrixPushButton2, SIGNAL(clicked()), this, SLOT(show_matrix_of_correlations2()));
}
void
additional_parts_dialog::on_down(wxCommandEvent &) {
  if (1 >= m_files.size())
    return;

  save_selection([&]() {
      // Cannot use std::swap() on vector<bool> members due to specialization.
      std::vector<char> selected;
      for (size_t idx = 0; m_files.size() > idx; ++idx)
        selected.push_back(m_lv_files->IsSelected(idx));

      for (int idx = m_files.size() - 2; 0 <= idx; --idx)
        if (selected[idx] && !selected[idx + 1]) {
          std::swap(m_files[idx + 1],  m_files[idx]);
          std::swap(selected[idx + 1], selected[idx]);
        }

      repopulate();
    });
}
예제 #6
0
파일: tools.c 프로젝트: kmels/x-painter
void paste(GtkWidget *widget, gpointer data){
  cairo_t *cr = gdk_cairo_create(canvas->window);  
  //save_current_surface(cairo_get_target(cr));
  
  // GError          *error = NULL;
  //gdk_pixbuf_save (current_surface_pixbuf, "current.png", "png", &error,NULL);

  double clipboard_width = (double) gdk_pixbuf_get_width(clipboard_pixbuf);
  double clipboard_height = (double) gdk_pixbuf_get_height(clipboard_pixbuf);  

  selection_x1 = paste_x1;
  selection_y1 = paste_y1;
  selection_x2 = paste_x1+clipboard_width;
  selection_y2 = paste_y1+clipboard_height;
  
  gdk_cairo_set_source_pixbuf(cr,clipboard_pixbuf,paste_x1,paste_y1);
  cairo_paint(cr);
  current_tool = XPainter_MOVE_TOOL;
  
  mark_selection(cr,selection_x1,selection_y1,selection_x2,selection_y2);
  save_selection(selection_x1,selection_y1,selection_x2,selection_y2);
}