Пример #1
0
void QTodoList::paste()
{
	if(QCB::get()->isEmpty())
			return;

	deselectAll();

	QTodoRadioDialog radio_dialog(tr("Paste todos"),tr("You are about to paste todos"));
	radio_dialog.setIcon(QTP::editpaste.s(16,16));

	radio_dialog.add(QTP::add_top,tr("Paste at top"),TDP_ATTOP);
	if(count() > 0)
		radio_dialog.add(QTP::add_bottom,tr("Paste at bottom"),TDP_ATBOTTOM);

	if(radio_dialog.exec() == QDialog::Accepted)
	{
		QTUM::get()->startRecording();
		switch(radio_dialog.selected())
		{
		case TDP_ATTOP:
			pasteAtTop();
			break;
		case TDP_ATBOTTOM:
			pasteAtBottom();
			break;
		}
		QTUM::get()->stopRecording();
	}
}
Пример #2
0
void QTodoLists::removeCurrent()
{
	if(QTodoListViewItem* item = currentListItem())
	{
		QTodoRadioDialog radio_dialog(tr("Remove list"),tr("You are about to remove the %1-list").arg(item->listWidget()->getHeader()->getName()));
		radio_dialog.setIcon(QTP::yellow_minus.s(12,12));	

		radio_dialog.add(QTP::hdd,tr("Remove from filesystem"),LRID_FILESYSTEM);
		radio_dialog.add(QTP::todo_list.s(32,32),tr("Remove from QTodo"),LRID_QTODO);
		if(radio_dialog.exec() != QDialog::Accepted)
			return;

		QString file;
		switch(radio_dialog.selected())
		{
			case LRID_FILESYSTEM:
				file = item->listWidget()->getFile();
			case LRID_QTODO:
				QTUM::get()->deleteUndosRelatedToList(item->list());
				delete item->listWidget();
				delete item;
				if(firstChild())
					setSelected(firstChild(),true);
				else
					emit listChanged();
				if(!file.isEmpty())
					QFile::remove(file);
				break;
		}
	}
}
Пример #3
0
void QTodoList::_delete()
{
	if(!isItemSelected())
		return;

	QTodoRadioDialog radio_dialog(tr("Delete todos"),tr("You are about to delete todos"));
	radio_dialog.setIcon(QTP::editdelete.s(16,16));

	radio_dialog.add(QTP::editdelete,tr("Delete todos"),0);

	if(radio_dialog.exec() != QDialog::Accepted)
		return;

	preserveContentsYPos();
	QTodoListIterator it(this);
	QTUM::get()->startRecording();
	int last_depth = -1;
	bool last_deleted = false;
	for(;it.current();++it)
	{
		if(QTodoItem* item = dynamic_cast<QTodoItem*>(it.current()))
		{
			if(!item->isSelected())
			{
				if(item->getDepth() - 1 > last_depth)
				{
					QTUM::get()->addChange(new QTodoChangeDepth(this,findWidget(item),item->getDepth()));
					item->setDepth(last_depth+1);
				}

				last_depth = item->getDepth();
				if(last_deleted)
					item->setDepth(item->getDepth());
				last_deleted = false;
				continue;
			}
			else
			{
				last_deleted = true;
			}

			it.remove();
		}
	}
	QTUM::get()->stopRecording();
	restoreContentsYPos();
}
Пример #4
0
void series_view_toggle_sort (GtkWidget *w, windata_t *vwin)
{
    const char *opts[] = {
	N_("Ascending"),
	N_("Descending"),
	N_("Original order")
    };
    series_view *sview = (series_view *) vwin->data;
    int sort_opt;
    
    if (series_view_allocate(sview)) {
	return;
    }

    sort_opt = radio_dialog(NULL, _("Sort order:"), opts, 
			    3, 0, 0, vwin->main);
    
    if (sort_opt < 0) {
	return;
    } else if (sort_opt == 2) {
	/* dataset order */
	if (!sview->sorted) {
	    return; /* no-op */
	} else {
	    qsort(sview->points, sview->npoints, 
		  sizeof sview->points[0], unsort_points);
	    sview->sorted = 0;
	    sview->view = VIEW_STANDARD;
	}
    } else if (sort_opt == 0) {
	qsort(sview->points, sview->npoints, 
	      sizeof sview->points[0], sort_points);
	sview->sorted = 1;
	sview->view = VIEW_CUSTOM;
    } else {
	qsort(sview->points, sview->npoints, 
	      sizeof sview->points[0], sort_points_down);
	sview->sorted = 1;
	sview->view = VIEW_CUSTOM;
    }

    single_series_view_print(vwin);
}
Пример #5
0
void menu_boxplot_callback (int varnum)
{
    const char *opts[] = {
	N_("Simple boxplot"),
	N_("With confidence interval for median"),
	N_("Factorized")
    };
    int ret;

    ret = radio_dialog(_("gretl: define graph"), NULL, 
		       opts, 3, 0, 0, NULL);

    if (ret == 0) {
	do_boxplot_var(varnum, OPT_NONE);
    } else if (ret == 1) {
	do_boxplot_var(varnum, OPT_O);
    } else if (ret == 2) {
	selector_set_varnum(varnum);
	selection_dialog(GR_FBOX, _("gretl: define graph"), 
			 do_factorized_boxplot);
    }
}
Пример #6
0
int display_graph_page (GtkWidget *parent)
{
    const char *opts[] = {
	N_("color"),
	N_("monochrome")
    };
    const char *sdir = get_session_dirname();
    gchar *latex_orig = NULL;
    int resp, err = 0;

    if (gpage.ngraphs == 0) {
	gpage_errmsg(_("The graph page is empty"), 1);
	return 1;
    }

    resp = radio_dialog(_("graph page options"), NULL, opts, 
			2, 0, 0, parent);
    if (resp < 0) {
	return 0;
    }

    gpage.mono = (resp == 1);

    gretl_chdir(sdir);

    gpage_filenames_init(NULL);

    if (get_tex_use_pdf()) {
	gpage.term = GP_TERM_PDF;
    } else {
	gpage.term = GP_TERM_EPS;
    }

    /* write the LaTeX driver file */
    err = make_graphpage_tex();

    if (!err) {
	/* transform individual plot files and compile 
	   using gnuplot */
	err = make_gp_output();
    }

    if (!err) {
	/* compile LaTeX */
	err = latex_compile_graph_page();
    }

    if (!err) {
	/* display output file */
	err = real_display_gpage();
    }

    gpage_revert_compiler(latex_orig);
    gpage_cleanup();

    if (err) {
	gui_errmsg(err);
    }

    return err;
}
Пример #7
0
void QTodoList::pasteTodo(QTodoItem* todo)
{
	if(QCB::get()->isEmpty())
			return;

	deselectAll();
	todo->setSelected(true);

	QTodoRadioDialog radio_dialog(tr("Paste todos"),tr("You are about to paste todos"));
	radio_dialog.setIcon(QTP::editpaste.s(16,16));

	radio_dialog.add(QTP::add_top,tr("Paste at top"),TDP_ATTOP);
	radio_dialog.add(QTP::add_above,tr("Paste above"),TDP_ABOVE);
	radio_dialog.add(QTP::add_below,tr("Paste below"),TDP_BELOW);
	radio_dialog.add(QTP::add_sub,tr("Paste as sub-todos"),TDP_SUB);
	radio_dialog.add(QTP::add_bottom,tr("Paste at bottom"),TDP_ATBOTTOM);

	if(radio_dialog.exec() == QDialog::Accepted)
	{
		//preserveContentsYPos();
		int pos;
		int last_depth = todo->getDepth();
		int base_depth = todo->getDepth() - QCB::get()->minDepth();//(*QCB::get()->getItems()->begin())->getDepth();
		QTUM::get()->startRecording();
		QTodoItem* item = 0;
		switch(radio_dialog.selected())
		{
		case TDP_ATTOP:
			pasteAtTop();
			break;
		case TDP_ATBOTTOM:
			pasteAtBottom();
			break;
		case TDP_ABOVE:
			pos = findWidget(todo);
			for(QTodoItemVector::reverse_iterator it = QCB::get()->getItems()->rbegin(); it != QCB::get()->getItems()->rend(); ++it)
			{
				item = new QTodoItem(*(*it));
				insertTodo(item,pos,(*it)->getDepth() + base_depth);
				ensureItemVisible(item);
				
				if(item->getDepth() > last_depth + 1)
				{
					QTUM::get()->addChange(new QTodoChangeDepth(this,findWidget(item),item->getDepth()));
					item->setDepth(last_depth + 1);
				}
		
				last_depth = item->getDepth();
			}
			fixItemSize(item);
			QCB::get()->clear();
			break;
		case TDP_BELOW:
			pos = findPosBelowTodoItem(todo);
			for(QTodoItemVector::iterator it = QCB::get()->getItems()->begin(); it != QCB::get()->getItems()->end(); ++it)
			{
				item = new QTodoItem(*(*it));
				insertTodo(item,pos,(*it)->getDepth() + base_depth);
				ensureItemVisible(item);

				if(item->getDepth() > last_depth + 1)
				{
					QTUM::get()->addChange(new QTodoChangeDepth(this,findWidget(item),item->getDepth()));
					item->setDepth(last_depth + 1);
				}
		
				last_depth = item->getDepth();
				pos++;
			}
			fixItemSize(item);
			QCB::get()->clear();
			break;
		case TDP_SUB:
			pos = findWidget(todo) + 1;
			for(QTodoItemVector::iterator it = QCB::get()->getItems()->begin(); it != QCB::get()->getItems()->end(); ++it)
			{
				item = new QTodoItem(*(*it));
				insertTodo(item,pos,(*it)->getDepth() + base_depth + 1);
				ensureItemVisible(item);

				if(item->getDepth() > last_depth + 1)
				{
					QTUM::get()->addChange(new QTodoChangeDepth(this,findWidget(item),item->getDepth()));
					item->setDepth(last_depth + 1);
				}
		
				last_depth = item->getDepth();
				pos++;
			}
			fixItemSize(item);
			QCB::get()->clear();
			break;
		}
		QTUM::get()->stopRecording();
		//restoreContentsYPos();
		deselectAll();
	}
}