Example #1
0
void FlushMarker(PBSynopsisItem *item)
{
	// Flush marker or comment on page
	if (item != NULL && (item->GetType() == SYNOPSIS_MARKER || item->GetType() == SYNOPSIS_COMMENT))
	{
		int spi, sei, sci, epi, eei, eci;
		PBSynopsisMarker *marker = (PBSynopsisMarker *)item;
		if (marker != NULL)
		{
			unpack_position(marker->GetLongPosition(), &spi, &sei, &sci);
			unpack_position(marker->GetEndLongPosition(), &epi, &eei, &eci);
			int i;
			for (i = 0; i < 2; i++)
			{
				bookview->selectionModel().activate(0, 0);
				bookview->selectionModel().extendTo(ScreenWidth(), ScreenHeight());
				bookview->selectionModel().SetSelection(spi, sei, sci, epi, eei, eci);
				repaint_all(-2);
				PartialUpdateBW(0, 0, ScreenWidth(), ScreenHeight()-PanelHeight());
				bookview->selectionModel().clear();
				repaint_all(-2);
				PartialUpdateBW(0, 0, ScreenWidth(), ScreenHeight()-PanelHeight());
			}
		}
	}
}
Example #2
0
/** 
 * Function used to set an attribute value of a IupCells object
 * @param h handle to the IupCells object 
 * @param attr attribute to be read
 * @param value the new attribute value
 */
static void cells_setattrib(Ihandle *h, char *attr, char *value) {

  /* Getting cell struct pointer saved in iup handle */
  TCells* obj = (TCells*) iupGetEnv(h, "_IUPCELLS_DATA");

  if (obj == NULL || attr == NULL) return;
 
  if (iupStrEqual(attr, IUP_BUFFERIZE)) { 
     if (value == NULL || iupStrEqualNoCase(value, IUP_NO)) { 
        obj->bufferize = 0;
        adjust_scrolls(obj);
        repaint_all(obj);
     }
     else obj->bufferize = 1;
  }
  else if (iupStrEqual(attr, IUP_REPAINT)) { 
     obj->bufferize = 0;
     adjust_scrolls(obj);
     repaint_all(obj); 
  }
  else if (iupStrEqual(attr, IUP_NO_COLOR)) { 
     if (value != NULL) obj->no_color = cdIupConvertColor(value);
     repaint_all(obj); 
  }
  else if (iupStrEqual(attr, IUP_ORIGIN)) { 
     if (adjust_origin(obj, value)) repaint_all(obj);
  }
  else if (iupStrEqual(attr, IUP_NON_SCROLLABLE_COLS)) { 
     obj->non_scrollable_cols = atoi(value);
     repaint_all(obj);
  }
  else if (iupStrEqual(attr, IUP_NON_SCROLLABLE_LINES)) { 
     obj->non_scrollable_lins = atoi(value);
     repaint_all(obj);
  }
  else if (iupStrEqual(attr, IUP_BOXED)) { 
     if (value != NULL && iupStrEqualNoCase(value, IUP_NO)) obj->boxed = 0;
     else obj->boxed = 1;
     repaint_all(obj);
  }
  else if (iupStrEqual(attr, IUP_CLIPPED)) { 
     if (value != NULL && iupStrEqualNoCase(value, IUP_NO)) obj->clipped = 0;
     else obj->clipped = 1;
     repaint_all(obj);
  }
  else if (iupStrEqual(attr, IUP_FULL_VISIBLE)) { 
     int i, j;
     if (iupStrToIntInt(value, &i, &j, ':') != 2) return;
     set_full_visible(obj, i, j);
     repaint_all(obj);
  }
  /* default case: using default iup adition in hash table */
  else iupCpiDefaultSetAttr(h, attr, value);
}
Example #3
0
void
delete_poi(poi_t *p)
{
	char *db;
	char *sql;
	int res;

	printf("*** %s(): \n",__PRETTY_FUNCTION__);

	

	db = g_strconcat(tangogps_dir, "/", POI_DB, NULL);	
	
	sql = g_strdup_printf( 	
			"DELETE FROM "
				"poi "
			"WHERE "
				"idmd5='%s'" 
			, p->idmd5);

printf("SQL: %s\n",sql);

	res = sql_execute(db, sql, NULL);
	

	repaint_all();

	
	
}
Example #4
0
static void synopsis_toc_selected(char *pos)
{
	long long position = 0;
	TSynopsisItem::PositionToLong(pos, &position);
	cpos = position;

	PBSynopsisItem *cur = SynTOC.GetCurrent();

	if (cur != NULL && cur->GetType() == SYNOPSIS_PEN)
	{
		PBSynopsisPen *pen = (PBSynopsisPen *)cur;
		ChangeSettings(SynTOC.GetSettings()->GetFB2Settings(pen->GetSettingsId()));
	}

	int p = position_to_page(cpos);
	if (is_footnote_mode())
	{
		((FBReader *)mainApplication)->showBookTextView();
	}
//	if (is_footnote_mode() || p >= npages) {
	if (p >= npages) {
		set_position(cpos);
//		mainApplication->doAction(ActionCode::PAGE_SCROLL_FORWARD);
		mainApplication->refreshWindow();
	} else {
		cpos = page_to_position(p);
		set_position(cpos);
		mainApplication->refreshWindow();
	}
	calc_position_changed = 1;
	SetEventHandler(PBMainFrame::main_handler);
	repaint_all(0);
	FlushMarker(cur);
}
Example #5
0
void MainWindow::Init() {

    this->show();

    R = ui->graphicsView;
    R->setDrawingArea(xmin,xmax,ymin,ymax);
    R->Scene->setSceneRect(0,0,R->geometry().width()-3,R->geometry().height()-3);


    ui->graphicsView->setMouseTracking(true);

    connect(R,SIGNAL(repaint_all()),this,SLOT(drawAll()));

    //Scenario
    senario = new Scenario();
    QString sf,sg;
    senario->load(sf,sg);


    ui->textf->setPlainText(sf);
    ui->textg->setPlainText(sg);


    Simu = new simulation();
    sivia = NULL;
    on_push_run_clicked();


}
Example #6
0
void
set_current_wp(double lat, double lon)
{
	global_wp_on = TRUE;
	global_wp.lat = lat;
	global_wp.lon = lon;
	
	
	repaint_all();
}
Example #7
0
void SelectionTimer()
{
	repaint_all(-1);
	ToolBar.OutputPage(BitmapFromScreen(0, 0, ScreenWidth(), ScreenHeight()-PanelHeight()),
				1, updMarkerx, updMarkery, updMarkerw, updMarkerh);
	if (++usersleep < 50)
		SetHardTimer("SelectionTimer", SelectionTimer, 25);
	else
		MarkerHandler(EVT_POINTERUP, lastx, lasty);
}
Example #8
0
/** 
 * IUP canvas callback for mouse press/unpress. 
 */
static int cells_repaint(Ihandle *h) {
  /* Getting cell struct pointer saved in iup handle */
  TCells* obj = (TCells*) iupGetEnv(h, "_IUPCELLS_DATA");
  if (!obj) return IUP_DEFAULT;

  if (!obj->cddbuffer)
    cells_createcanvas(obj, h);

  if (!obj->cddbuffer)
    return IUP_DEFAULT;

  /* Just repainting all cells */
  repaint_all(obj);

  return IUP_DEFAULT;
}
Example #9
0
void OpenMarkerMenu(PBSynopsisItem *item)
{
	// Prepare page and open marker menu
	if (item != NULL)
	{
		int spi, sei, sci, epi, eei, eci;
		PBSynopsisMarker *marker = (PBSynopsisMarker *)item;
		selectingMarker = false;
		ClearTimer(SelectionTimer);
		unpack_position(marker->GetLongPosition(), &spi, &sei, &sci);
		unpack_position(marker->GetEndLongPosition(), &epi, &eei, &eci);
		bookview->selectionModel().SetSelection(spi, sei, sci, epi, eei, eci);
		repaint_all(-1);
		ToolBar.OutputPage(BitmapFromScreen(0, 0, ScreenWidth(), ScreenHeight()-PanelHeight()));
		ToolBar.OpenMarkerMenu(marker);
		bookview->selectionModel().clear();
	}
}
Example #10
0
void
delete_poi(poi_t *p)
{
	char *db;
	char *sql;

	db = g_strconcat(foxtrotgps_dir, "/", POI_DB, NULL);	
	
	sql = g_strdup_printf( 	
			"DELETE FROM "
				"poi "
			"WHERE "
				"idmd5='%s'" 
			, p->idmd5);

	sql_execute(db, sql, NULL);

	repaint_all();
}
Example #11
0
/** 
 * IUP canvas callback for mouse press/unpress. 
 */
static int cells_scroll(Ihandle *h) {
  TScrollCb func = NULL;
  int value = IUP_DEFAULT;
  int fline = -999;
  int fcol = -999;

  /* Getting cell struct pointer saved in iup handle */
  TCells* obj = (TCells*) iupGetEnv(h, "_IUPCELLS_DATA");
  if (obj == NULL) return IUP_IGNORE;
  fline = get_first_line(obj);
  fcol = get_first_col(obj);

  /* Checking the existence of a scroll bar callback. If the application
   * has set one, it will be called now. If the application returns
   * IUP_DEFAULT, the cells will be repainted. */
  func = (TScrollCb) IupGetCallback(h, "SCROLLING_CB");
  if (func != NULL) value = (*func)(obj->self, fline, fcol);
  if (value == IUP_DEFAULT) repaint_all(obj);

  /* Returning the callback */
  return value;
}
Example #12
0
//--------------Traffic download--------------------------------
//--------------Traffic autodownloadtimer--------------------------------
gboolean auto_load_trf_timer()
{
	repaint_all();

	return FALSE;
}
Example #13
0
int MarkerHandler(int type, int par1, int par2)
{
	if (type == EVT_POINTERDOWN)
	{
		selectingMarker = true;
		restore_current_position();
		mainApplication->refreshWindow();
		bookview->selectionModel().clear();
		bookview->selectionModel().activate(par1 - imgposx, par2 - imgposy);
		SetHardTimer("SelectionTimer", SelectionTimer, 250);
		selMarkery1 = selMarkery2 = lasty = par2;
		lastx = par1;
		usersleep = 0;
	}
	else if (type == EVT_POINTERMOVE)
	{
		if (++trailMarker > 8)
		{
			if (selectingMarker)
			{
				lastx = par1;
				lasty = par2;
				bookview->selectionModel().extendTo(par1 - imgposx, par2 - imgposy);
				selMarkery2 = par2;
				usersleep = 0;
			}
			trailMarker = 0;
		}
	}
	else if (type == EVT_POINTERUP)
	{
		if (!selectingMarker)
			return 0;
		selectingMarker = false;
		ClearTimer(SelectionTimer);
		restore_current_position();
		mainApplication->refreshWindow();
		bookview->selectionModel().extendTo(par1 - imgposx, par2 - imgposy);

		long long spos, epos;
		bool clickOnly, emptyText;
		GetSelectionInfo(&spos, &epos, &emptyText, &clickOnly);
		if ((clickOnly && SynTOC.GetMarkerByPos(spos) != NULL) || emptyText)
		{
			OpenMarkerMenu(SynTOC.GetMarkerByPos(spos));
		}
		else
		{
			MergeMarkers(spos, epos);
			bookview->selectionModel().clear();
			repaint_all(-2);
			ToolBar.OutputPage(BitmapFromScreen(0, 0, ScreenWidth(), ScreenHeight()-PanelHeight()),
						2, updMarkerx, updMarkery, updMarkerw, updMarkerh);
		}

	}
	else if (type == EVT_POINTERHOLD || type == EVT_POINTERLONG)
	{
		restore_current_position();
		mainApplication->refreshWindow();
		bookview->selectionModel().extendTo(par1 - imgposx, par2 - imgposy);

		long long spos, epos;
		bool clickOnly, emptyText;
		GetSelectionInfo(&spos, &epos, &emptyText, &clickOnly);
		if (clickOnly || emptyText)
		{
			OpenMarkerMenu(SynTOC.GetMarkerByPos(spos));
		}
	}
	return 0;
}
Example #14
0
void SynopsisToolBar::RenderPage()
{
	repaint_all(-2);
}