static void layer_change_revert(struct LayerChange *change, Diagram *dia) { switch (change->type) { case TYPE_DELETE_LAYER: data_add_layer_at(dia->data, change->layer, change->index); break; case TYPE_ADD_LAYER: data_remove_layer(dia->data, change->layer); break; case TYPE_RAISE_LAYER: data_lower_layer(dia->data, change->layer); break; case TYPE_LOWER_LAYER: data_raise_layer(dia->data, change->layer); break; } diagram_add_update_all(dia); if (layer_dialog->diagram == dia) { layer_dialog_set_diagram(dia); } change->applied = 0; }
static PyObject * PyDiaDiagramData_LowerLayer(PyDiaDiagramData *self, PyObject *args) { PyDiaLayer *layer; if (!PyArg_ParseTuple(args, "O!:DiagramData.lower_layer", &PyDiaLayer_Type, &layer)) return NULL; data_lower_layer(self->data, layer->layer); Py_INCREF(Py_None); return Py_None; }
static void layer_dialog_lower_callback(GtkWidget *widget, gpointer gdata) { Layer *layer; Diagram *dia; GtkWidget *selected; GList *list = NULL; int pos; dia = layer_dialog->diagram; if ((dia != NULL) && (dia->data->layers->len>1)) { assert(GTK_LIST(layer_dialog->layer_list)->selection != NULL); selected = GTK_LIST(layer_dialog->layer_list)->selection->data; pos = gtk_list_child_position(GTK_LIST(layer_dialog->layer_list), selected); if (pos < dia->data->layers->len-1) { layer = DIA_LAYER_WIDGET(selected)->layer; data_lower_layer(dia->data, layer); list = g_list_prepend(list, selected); g_object_ref(selected); gtk_list_remove_items(GTK_LIST(layer_dialog->layer_list), list); gtk_list_insert_items(GTK_LIST(layer_dialog->layer_list), list, pos + 1); g_object_unref(selected); gtk_list_select_item(GTK_LIST(layer_dialog->layer_list), pos+1); diagram_add_update_all(dia); diagram_flush(dia); undo_layer(dia, layer, TYPE_LOWER_LAYER, 0); undo_set_transactionpoint(dia->undo); } } }