Esempio n. 1
0
static void main_layer_update_proc(Layer *layer, GContext *ctx) {
    draw_time(layer, ctx);

    if (show_battery) {
        draw_battery(layer, ctx);
    }

    if (show_timeline) {
        draw_timeline(layer, ctx);
    }
}
void top_right_motion_notify_event(GtkWidget *widget, GdkEventButton *event, gpointer data)
{
	TimeLinePrivate		*priv;
	GtkAllocation		area;						// Rectangular area
	guint 				temp_int;
	gint 				distance_moved;
	gfloat				time_moved;
	gint				pps;						// Holds the number of pixels per second used when drawing
	priv = data;
	pps = time_line_get_pixels_per_second();

	if(TRUE == priv->left_resize_active){
		top_left_motion_notify_event(priv->top_left_evb,event,data);
		return;
	}
	if(FALSE == priv->cursor_drag_active)
	{
		priv->cursor_drag_active = TRUE;
		priv->stored_x = event->x;
	}
	else
	{
		temp_int = CLAMP(event->x, 0, GTK_WIDGET(widget)->allocation.width);
		distance_moved = priv->stored_x - event->x;
		time_moved = ((gfloat) distance_moved) / pps;

		area.x = (priv->cursor_position * pps) - (CURSOR_HEAD_WIDTH);
		area.y = 0;
		area.height = GTK_WIDGET(widget)->allocation.height;
		area.width = CURSOR_HEAD_WIDTH * 2;
		gdk_window_invalidate_rect(GTK_WIDGET(widget)->window, &area, TRUE);

		// Update the cursor position
		priv->cursor_position = priv->cursor_position - time_moved;

		// Safety check
		if (0 > priv->cursor_position)
			priv->cursor_position=0;
		time_line_internal_draw_cursor(priv->main_table->parent,priv->cursor_position * pps);

		area.x = (priv->cursor_position * pps) - (CURSOR_HEAD_WIDTH );
		gdk_window_invalidate_rect(GTK_WIDGET(widget)->window, &area, TRUE);
		area.height = priv->bot_right_evb->allocation.height;
		gdk_window_invalidate_rect(GTK_WIDGET(priv->bot_right_evb)->window, &area, TRUE);
				priv->stored_x = event->x;

		draw_timeline();
	}

}
Esempio n. 3
0
void fcfs::on_next_pushButton_clicked()
{
    int process_no = ui->process_no_label->text().toInt();
    double arrival_time = ui->arrival_time_doubleSpinBox->value();
    double burst_time = ui->burst_time_doubleSpinBox->value();
    list[process_no-1].set_id(process_no);
    list[process_no-1].set_arrival_time(arrival_time);
    list[process_no-1].set_burst_time(burst_time);
    int next_process_no = (process_no % number_of_processes) + 1;
    QString next_process_no_label = QString("%1").arg(next_process_no);
    ui->process_no_label->setText(next_process_no_label);
    QString next_process_label = QString("Process #%1:").arg(next_process_no);
    ui->process_label->setText(next_process_label);
    ui->arrival_time_doubleSpinBox->setValue(list[next_process_no-1].get_arrival_time());
    ui->burst_time_doubleSpinBox->setValue(list[next_process_no-1].get_burst_time());
    QLinkedList<process> timeline;
    schedule_processess(timeline);
    draw_timeline(timeline);
    ui->burst_time_doubleSpinBox->setFocus();
}
Esempio n. 4
0
File: main.c Progetto: scoopr/ngi
void draw(int w, int h) {

    float cy;
    float lh = 16*1.2f;
    float left = lh*2;
//    int i = 0;

    layout(w,h);
    

    rend->resize(w,h);
    rend->clear();

    draw_pointers();
    draw_timeline();

    draw_tachometer();

    drawCorners(w,h);

    cy = h-lh*2;

    rend->text(left, cy, "NGI Probe");

    cy-=lh*2;
#if 0
    for(; i < num_last_events && cy > lh*2; ++i)
    {

        int j = (cur_last_event-i-1 + max_last_events)%max_last_events;

        
        const char* str = ngi_event_name(last_events[j].type);
        rend->text(left, cy, "Event %4d: %s", event_serials[j], str);

        cy-=lh;
    }
#endif

    
}
Esempio n. 5
0
void slide_delete(void)
{
	// Local variables
	GString				*message;					// Used to construct message strings
	GtkTreePath			*new_path;					// Temporary path
	gint				num_slides;					// Number of slides in the whole slide list
	GtkTreePath			*old_path = NULL;			// The old path, which we'll free
	gint				slide_position;				// Which slide in the slide list we are deleting
	GtkTreeSelection	*film_strip_selector;		//
	GtkTreeIter			selection_iter;				//
	undo_history_data	*undo_item_data = NULL;		// Memory structure undo history items are created in


	// Are we trying to delete the only slide in the project (not good)?
	set_slides(g_list_first(get_slides()));
	num_slides = g_list_length(get_slides());
	if (1 == num_slides)
	{
		// Yes we are, so give a warning message and don't delete the slide
		message = g_string_new(NULL);
		g_string_printf(message, "%s ED462: %s", _("Error"), _("You must leave at least one slide in a project."));
		display_warning(message->str);
		g_string_free(message, TRUE);
		return;
	}

	// Determine where the slide is positioned in the project
	slide_position = g_list_position(get_slides(), get_current_slide());

	// Create and store the undo history item for this slide
	undo_item_data = g_new0(undo_history_data, 1);
	undo_item_data->layer_data_new = NULL;  // NULL means not set
	undo_item_data->layer_data_old = NULL;  // NULL means not set
	undo_item_data->position_new = -1;  // -1 means not set
	undo_item_data->position_old = slide_position;
	undo_item_data->slide_data = get_current_slide_data();
	undo_history_add_item(UNDO_DELETE_SLIDE, undo_item_data, TRUE);

	// Remove the current slide from the slide list
	set_slides(g_list_remove_link(get_slides(), get_current_slide()));

	// Remove the current slide from the film strip
	film_strip_selector = gtk_tree_view_get_selection(GTK_TREE_VIEW(get_film_strip_view()));
	gtk_tree_selection_get_selected(film_strip_selector, NULL, &selection_iter);
	gtk_list_store_remove(GTK_LIST_STORE(get_film_strip_store()), &selection_iter);

	// * Update the currently selected slide to point to the next slide *
	if (num_slides == (slide_position + 1))
	{
		// If we're deleting the last slide, we'll need to point to the previous one instead
		slide_position--;
	}
	set_current_slide(g_list_nth(get_slides(), slide_position));

	// Select the next thumbnail in the film strip and scroll to display it
	gtk_tree_view_get_cursor(GTK_TREE_VIEW(get_film_strip_view()), &new_path, NULL);
	if (NULL != new_path)
		old_path = new_path;  // Make a backup of the old path, so we can free it
	new_path = gtk_tree_path_new_from_indices(slide_position, -1);
	gtk_tree_view_set_cursor(GTK_TREE_VIEW(get_film_strip_view()), new_path, NULL, FALSE);
	gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(get_film_strip_view()), new_path, NULL, TRUE, 0.5, 0.0);
	if (NULL != old_path)
		gtk_tree_path_free(old_path);  // Free the old path

	// Redraw the timeline
	draw_timeline();

	// Redraw the workspace
	draw_workspace();

	// Set the changes made variable
	set_changes_made(TRUE);

	// Update the status bar
	gtk_progress_bar_set_text(GTK_PROGRESS_BAR(get_status_bar()), _(" Slide deleted"));
	gdk_flush();
}
Esempio n. 6
0
void layer_move_up(void)
{
	// Local variables
	GList				*above_layer;				// The layer above the selected one
	GList				*layer_pointer;				// Points to the layers in the selected slide
	GList				*our_layer;					// The selected layer
	guint				selected_row;				// Holds the row that is selected


	// If no project is loaded then don't run this function
	if (NULL == get_current_slide())
	{
		// Make a beep, then return
		gdk_beep();
		return;
	}

	// Initialise various things
	layer_pointer = get_current_slide_layers_pointer();
	layer_pointer = g_list_first(layer_pointer);

	// Change the focus of the window to be this widget
	set_delete_focus(FOCUS_LAYER);

	// Determine which layer the user has selected in the timeline
	selected_row = time_line_get_selected_layer_num(get_current_slide_timeline_widget());
	if (0 == selected_row)
	{
		// We're already at the top of the list, so return
		gdk_beep();
		return;
	}

	// Get details of the layers we're moving around
	our_layer = g_list_nth(layer_pointer, selected_row);
	above_layer = g_list_nth(layer_pointer, selected_row - 1);

	// Check if the user has selected the Background layer, if so we return (ignoring this move request)
	if (TRUE == ((layer *) our_layer->data)->background)
	{
		// We're processing a background layer, so return
		gdk_beep();
		return;
	}

	// Move the row up one in the layer list
	layer_pointer = g_list_remove_link(layer_pointer, our_layer);
	layer_pointer = g_list_insert_before(layer_pointer, above_layer, our_layer->data);
	set_current_slide_layers_pointer(layer_pointer);

	// Move the row up one in the timeline widget
	time_line_set_selected_layer_num(get_current_slide_timeline_widget(), selected_row - 1);

	// Redraw the timeline area
	draw_timeline();

	// Redraw the workspace
	draw_workspace();

	// Recreate the slide thumbnail
	film_strip_create_thumbnail(get_current_slide_data());

	// Set the changes made variable
	set_changes_made(TRUE);

	// Update the status bar
	gtk_progress_bar_set_text(GTK_PROGRESS_BAR(get_status_bar()), _(" Layer moved up"));
	gdk_flush();
}