예제 #1
0
파일: main.cpp 프로젝트: vadmium/tul
void MainWnd::on_command(WORD wNotifyCode, WORD wID, HWND hwndCtl) {
  if(NULL != hwndCtl) {
    // message is from a control (not menu item nor accelerator)
    switch(wID) {
    case IDC_MEASURE:
      if(BN_CLICKED != wNotifyCode) {
        break;
      }
      if(BST_CHECKED == SendMessage(hwndCtl, BM_GETCHECK, 0, 0)) {
        shield->show();
      } else {
        shield->hide();
      }
      break;
      
    case IDC_XRES:
      if(EN_CHANGE == wNotifyCode) {
        int text_length = GetWindowTextLength(hwndCtl);
        char *text = new char[text_length + 1];
        GetWindowText(hwndCtl, text, text_length + 1);
        double new_res = atof(text);
        delete[] text;
        if(0 == new_res) {
          break;
        }
        x_res = new_res;
        update_x();
        update_area();
      }
      break;
      
    case IDC_YRES:
      if(EN_CHANGE == wNotifyCode) {
        int text_length = GetWindowTextLength(hwndCtl);
        char *text = new char[text_length + 1];
        GetWindowText(hwndCtl, text, text_length + 1);
        double new_res = atof(text);
        delete[] text;
        if(0 == new_res) {
          break;
        }
        y_res = new_res;
        update_y();
        update_area();
      }
      break;
    }
  }
}
예제 #2
0
/*-----------------------------------------------------------------------------------*/
void
ctk_draw_clear_window(struct ctk_window *window,
		      unsigned char focus,
		      unsigned char clipy1,
		      unsigned char clipy2)
{
  unsigned char i;
  unsigned char h;
  /*
  if(focus & CTK_FOCUS_WINDOW){
    textcolor(WINDOWCOLOR_FOCUS);
  } else {
    textcolor(WINDOWCOLOR);
    }*/
  textcolor(VNC_OUT_WINDOWCOLOR + focus);
  
  h = window->y + 2 + window->h;
  /* Clear window contents. */
  for(i = window->y + 2; i < h; ++i) {
    if(i >= clipy1 && i < clipy2) {
      cclearxy(window->x + 1, i, window->w);
    }
  }

  update_area(window->x + 1, window->y + 2, window->w, window->h);
}
예제 #3
0
/*-----------------------------------------------------------------------------------*/
void
ctk_draw_menus(struct ctk_menus *menus)
{
  struct ctk_menu *m;  

  
  /* Draw menus */
  textcolor(VNC_OUT_MENUCOLOR);
  gotoxy(0, 0);
  revers(1);
  cputc(' ');
  for(m = menus->menus->next; m != NULL; m = m->next) {
    if(m != menus->open) {
      update_area(wherex(), 0, strlen(m->title) + 1, 1);
      cputs(m->title);
      cputc(' ');
    } else {
      draw_menu(m);
    }
  }


  if(wherex() + strlen(menus->desktopmenu->title) + 1>= sizex) {
    gotoxy(sizex - strlen(menus->desktopmenu->title) - 1, 0);
  } else {
    cclear(sizex - wherex() -
	   strlen(menus->desktopmenu->title) - 1);
    update_area(wherex(), 0, sizex - wherex() -
		strlen(menus->desktopmenu->title) - 1, 1);
  }
  
  /* Draw desktopmenu */
  if(menus->desktopmenu != menus->open) {
    update_area(wherex(), 0, strlen(menus->desktopmenu->title) + 1, 1);
    cputs(menus->desktopmenu->title);
    cputc(' ');
  } else {
    draw_menu(menus->desktopmenu);
  }

  revers(0);



}
예제 #4
0
/*-----------------------------------------------------------------------------------*/
void
ctk_draw_dialog(struct ctk_window *dialog)
{
  unsigned char x, y;
  unsigned char i;
  unsigned char x1, y1, x2, y2;

  /*  textcolor(DIALOGCOLOR);*/
  textcolor(VNC_OUT_WINDOWCOLOR + CTK_FOCUS_DIALOG);

  x = dialog->x;
  y = dialog->y + 1;


  x1 = x + 1;
  y1 = y + 1;
  x2 = x1 + dialog->w;
  y2 = y1 + dialog->h;


  /* Draw dialog frame. */
  
  for(i = y1; i < y1 + dialog->h; ++i) {
    cputcxy(x, i, CH_DIALOGLBORDER);
    cputcxy(x2, i, CH_DIALOGRBORDER);
  }
  /*  cvlinexy(x, y1,
	   dialog->h);
  cvlinexy(x2, y1,
  dialog->h);*/

  
  for(i = x1; i < x2; ++i) {
    cputcxy(i, y, CH_DIALOGUPPERBORDER);
    cputcxy(i, y2, CH_DIALOGLOWERBORDER);
  }
    /*  chlinexy(x1, y,
	   dialog->w);
  chlinexy(x1, y2,
  dialog->w);*/

  cputcxy(x, y, CH_DIALOG_ULCORNER);
  cputcxy(x, y2, CH_DIALOG_LLCORNER);
  cputcxy(x2, y, CH_DIALOG_URCORNER);
  cputcxy(x2, y2, CH_DIALOG_LRCORNER);
  
  
  /* Clear dialog contents. */
  for(i = y1; i < y2; ++i) {
    cclearxy(x1, i, dialog->w);
  }

  draw_window_contents(dialog, CTK_FOCUS_DIALOG, 0, sizey,
		       x1, x2, y1, y2);

  update_area(dialog->x, dialog->y, dialog->w + 4, dialog->h + 4);
}
예제 #5
0
void
QcViewport::set_bearing(double bearing)
{
  if (bearing != m_state.bearing()) {
    begin_state_transaction();
    m_state.set_bearing(bearing);
    update_area(); // rotate polygon
    end_state_transaction();
  }
}
예제 #6
0
/*-----------------------------------------------------------------------------------*/
void
ctk_draw_widget(struct ctk_widget *w,
		unsigned char focus,
		unsigned char clipy1,
		unsigned char clipy2)
{
  struct ctk_window *win = w->window;
  struct ctk_icon *icon;
  unsigned char posx, posy, x, len;

  posx = win->x + 1;
  posy = win->y + 2;

  if(w == win->focused) {
    focus |= CTK_FOCUS_WIDGET;
  }
  
  draw_widget(w, posx, posy,
	      posx + win->w,
	      posy + win->h,
	      clipy1, clipy2,
	      focus);

  if(w->type != CTK_WIDGET_ICON) {
    update_area(posx + w->x,
		posy + w->y, w->w + 2, w->h);
  } else {
    icon = (struct ctk_icon *)w;

    len = strlen(icon->title);
    x = posx + w->x;
    if(x + len >= sizex) {
      x = sizex - len;
    }

    update_area(x, posy + w->y, len > 4? len: 4, w->h);    
  }
  
#ifdef CTK_CONIO_CONF_UPDATE
  CTK_CONIO_CONF_UPDATE();
#endif /* CTK_CONIO_CONF_UPDATE */
}
예제 #7
0
void
QcViewport::set_center(const QcWgsCoordinate & coordinate)
{
  // qInfo() << coordinate;
  if (coordinate != m_state.coordinate()) {
    begin_state_transaction();
    m_state.set_coordinate(coordinate);
    update_area(); // move polygon
    end_state_transaction();
  }
}
예제 #8
0
/*-----------------------------------------------------------------------------------*/
void
ctk_draw_clear(unsigned char y1, unsigned char y2)
{
  unsigned char i;

  textcolor(VNC_OUT_BACKGROUNDCOLOR);
  for(i = y1; i < y2; ++i) {
    cclearxy(0, i, sizex);
  }

  update_area(0, y1, sizex, y2 - y1);
}
예제 #9
0
void
QcViewport::set_zoom_level(unsigned int zoom_level)
{
  // Fixme: check is not performed at init
  if (zoom_level != m_state.zoom_level() and m_zoom_level_interval.contains(zoom_level)) {
    begin_state_transaction();
    m_state.set_zoom_level(zoom_level);
    update_area_size();
    update_area(); // scale polygon
    end_state_transaction();
  }
}
예제 #10
0
void
QcViewport::set_viewport_size(const QSize & size, float device_pixel_ratio)
{
  Q_UNUSED(device_pixel_ratio);
  // qInfo() << "viewport size" << size << device_pixel_ratio;
  m_viewport_size = size; // * device_pixel_ratio;
  m_device_pixel_ratio = 1; // device_pixel_ratio;

  update_zoom_level_interval();

  update_area_size();
  update_area();
}
예제 #11
0
/*-----------------------------------------------------------------------------------*/
static void
draw_menu(struct ctk_menu *m)
{
  unsigned char x, x2, y;

  textcolor(VNC_OUT_MENUCOLOR);
  x = wherex();
  cputs(m->title);
  cputc(' ');
  x2 = wherex();
  if(x + CTK_CONF_MENUWIDTH > sizex) {
    x = sizex - CTK_CONF_MENUWIDTH;
  }
  
  
  for(y = 0; y < m->nitems; ++y) {
    if(y == m->active) {
      textcolor(VNC_OUT_ACTIVEMENUCOLOR);
      revers(0);
    } else {
      textcolor(VNC_OUT_MENUCOLOR);	  
    }
    gotoxy(x, y + 1);
    if(m->items[y].title[0] == '-') {
      chline(CTK_CONF_MENUWIDTH);
    } else {
      cputs(m->items[y].title);
    }
    if(x + CTK_CONF_MENUWIDTH > wherex()) {
      cclear(x + CTK_CONF_MENUWIDTH - wherex());
    }
    revers(1);
  }
  
  gotoxy(x2, 0);
  textcolor(VNC_OUT_MENUCOLOR);  

  update_area(x, 0, CTK_CONF_MENUWIDTH, m->nitems + 1);
}
예제 #12
0
/**
 * Stop and process the CPU profiling data; collect stats and
 * prepare for more optimal sorting.
 */
void Profile_CpuStop(void)
{
	Uint32 *sort_arr, next;
	int active;

	if (cpu_profile.processed || !cpu_profile.enabled) {
		return;
	}

	log_last_loop();
	if (profile_loop.fp) {
		fflush(profile_loop.fp);
	}

	/* user didn't change RAM or TOS size in the meanwhile? */
	assert(cpu_profile.size == (STRamEnd + 0x20000 + TosSize) / 2);

	Profile_FinalizeCalls(&(cpu_callinfo), &(cpu_profile.all), Symbols_GetByCpuAddress);

	/* find lowest and highest addresses executed etc */
	next = update_area(&cpu_profile.ram, 0, STRamEnd/2);
	next = update_area(&cpu_profile.tos, next, (STRamEnd + TosSize)/2);
	next = update_area(&cpu_profile.rom, next, cpu_profile.size);
	assert(next == cpu_profile.size);

#if DEBUG
	if (skip_assert) {
		skip_assert = false;
	} else
#endif
	{
		assert(cpu_profile.all.misses == cpu_profile.ram.counters.misses + cpu_profile.tos.counters.misses + cpu_profile.rom.counters.misses);
		assert(cpu_profile.all.cycles == cpu_profile.ram.counters.cycles + cpu_profile.tos.counters.cycles + cpu_profile.rom.counters.cycles);
		assert(cpu_profile.all.count == cpu_profile.ram.counters.count + cpu_profile.tos.counters.count + cpu_profile.rom.counters.count);
	}

	/* allocate address array for sorting */
	active = cpu_profile.ram.active + cpu_profile.rom.active + cpu_profile.tos.active;
	sort_arr = calloc(active, sizeof(*sort_arr));

	if (!sort_arr) {
		perror("ERROR: allocating CPU profile address data");
		free(cpu_profile.data);
		cpu_profile.data = NULL;
		return;
	}
	printf("Allocated CPU profile address buffer (%d KB).\n",
	       (int)sizeof(*sort_arr)*(active+512)/1024);
	cpu_profile.sort_arr = sort_arr;
	cpu_profile.active = active;

	/* and fill addresses for used instructions... */
	sort_arr = index_area(&cpu_profile.ram, sort_arr);
	sort_arr = index_area(&cpu_profile.tos, sort_arr);
	sort_arr = index_area(&cpu_profile.rom, sort_arr);
	assert(sort_arr == cpu_profile.sort_arr + cpu_profile.active);
	//printf("%d/%d/%d\n", area->active, sort_arr-cpu_profile.sort_arr, active);

	Profile_CpuShowStats();
	cpu_profile.processed = true;
}
예제 #13
0
/*-----------------------------------------------------------------------------------*/
void
ctk_draw_window(struct ctk_window *window, unsigned char focus,
		unsigned char clipy1, unsigned char clipy2,
		unsigned char draw_borders)
{
  unsigned char x, y;
  unsigned char h;
  unsigned char x1, y1, x2, y2;
  unsigned char i;
  

  if(window->y + 1 >= clipy2) {
    return;
  }
    
  x = window->x;
  y = window->y + 1;
  x1 = x + 1;
  y1 = y + 1;
  x2 = x1 + window->w;
  y2 = y1 + window->h;

  if(draw_borders) {

    /* Draw window frame. */  
    textcolor(VNC_OUT_WINDOWCOLOR + focus);
    /*  if(focus & CTK_FOCUS_WINDOW) {
      textcolor(WINDOWCOLOR_FOCUS);
    } else {
      textcolor(WINDOWCOLOR);
      }*/

    if(y >= clipy1) {
      cputcxy(x, y, CH_ULCORNER);
      for(i = wherex() + window->titlelen + CTK_CONF_WINDOWMOVE * 2; i < x2; ++i) {
	cputcxy(i, y, CH_TITLEBAR);
      }
      cputcxy(x2, y, CH_URCORNER);
    }

    h = window->h;
  
    if(clipy1 > y1) {
      if(clipy1 - y1 < h) {
	h = clipy1 - y1;
	      y1 = clipy1;
      } else {
	h = 0;
      }
    }

    if(clipy2 < y1 + h) {
      if(y1 >= clipy2) {
	h = 0;
      } else {
	h = clipy2 - y1;
      }
    }
  
    for(i = y1; i < y1 + h; ++i) {
      cputcxy(x, i, CH_WINDOWLBORDER);
      cputcxy(x2, i, CH_WINDOWRBORDER);
    }

    /*  cvlinexy(x, y1, h);
	cvlinexy(x2, y1, h);  */

    if(y + window->h >= clipy1 &&
       y + window->h < clipy2) {
      cputcxy(x, y2, CH_LLCORNER);
      for(i = x1; i < x2; ++i) {
	cputcxy(i, y2, CH_WINDOWLOWERBORDER);
      }
      /*    chlinexy(x1, y2, window->w);*/
      cputcxy(x2, y2, CH_LRCORNER);
    }
  }

  draw_window_contents(window, focus, clipy1, clipy2,
		       x1, x2, y + 1, y2);

  update_area(window->x, window->y, window->w + 2, window->h + 2);
}
예제 #14
0
파일: main.cpp 프로젝트: vadmium/tul
 virtual void area(double area) {pixel_area = area; update_area();};