void labeling(void) { verticalProject(&cImg, vProjection); setBoundary(&cImg, vProjection, boundary); getYVals(&cImg, vProjection, boundary, heights); drawProject(&cImg, vProjection); drawBoundary(&cImg, boundary); }
/** * This is called when the control is repainted. */ /*afx_msg*/ void ChunkWatchControl::OnPaint() { ScopedDogWatch dogWatchScope(s_chunkWatchPaint); // The extents of the control: CRect fullExtents; GetClientRect(fullExtents); // The drawing contexts: CPaintDC paintDC(this); controls::MemDCScope memDCScope(memDC_, paintDC, &fullExtents); memDC_.FillSolidRect(fullExtents, ::GetSysColor(COLOR_BTNFACE)); // Calculate the drawing area: getDrawConstants(); // Draw the details: if ((drawOptions_ & DRAW_PROJECTVIEW) != 0) drawProject (memDC_); if ((drawOptions_ & DRAW_CHUNKS ) != 0) drawChunks (memDC_); if ((drawOptions_ & DRAW_UNLOADABLE ) != 0) drawUnloadable(memDC_); if ((drawOptions_ & DRAW_WORKING ) != 0) drawWorking (memDC_); if ((drawOptions_ & DRAW_GRID ) != 0) drawGrid (memDC_); if ((drawOptions_ & DRAW_USERPOS ) != 0) drawArrow (memDC_); if ((drawOptions_ & DRAW_FRUSTUM ) != 0) drawFrustum (memDC_); // Draw the outsides: memDC_.Draw3dRect ( extents_, // around the tiles itself CLR_BORDER, CLR_BORDER ); memDC_.Draw3dRect ( fullExtents, ::GetSysColor(COLOR_3DHILIGHT), ::GetSysColor(COLOR_3DSHADOW ) ); }
int main(int argc, char *argv[]) { int n, show_days = 0, but_stat = 0, microtm = 0, running = 0, force = 0; time_t last_time = 0; char *geometry = NULL, *xdisplay = NULL; static int signals[] = {SIGALRM, SIGHUP, SIGINT, SIGPIPE, SIGTERM, SIGUSR1, SIGUSR2, 0}; XEvent Event; assert(sizeof(char) == 1); umask(077); do_opts(argc, argv, &show_days, &xdisplay, &geometry, &force); path_len = strlen(getenv("HOME")) + strlen("/.wmwork/worklog") + 1; if ((dirName = malloc(path_len)) == NULL || (logname = malloc(path_len)) == NULL || (lockname = malloc(path_len)) == NULL) { fprintf(stderr, "%s: cannot allocate memory for path variable\n", PACKAGE_NAME); fprintf(stderr, "%s: %s\n", PACKAGE_NAME, strerror(errno)); exit(1); } snprintf(dirName, path_len, "%s/.wmwork", getenv("HOME")); snprintf(logname, path_len, "%s/worklog", dirName); snprintf(lockname, path_len, "%s/.#LOCK", dirName); if (chdir(dirName) < 0) { if (errno == ENOENT) { if (mkdir(dirName, 0777)) { fprintf(stderr, "%s: cannot mkdir '%s'\n", PACKAGE_NAME, dirName); fprintf(stderr, "%s: %s\n", PACKAGE_NAME, strerror(errno)); exit(1); } compat(); } else { fprintf(stderr, "%s: cannot chdir into '%s'\n", PACKAGE_NAME, dirName); fprintf(stderr, "%s: %s\n", PACKAGE_NAME, strerror(errno)); exit(1); } } for (n = 0; signals[n]; n++) { if (signal(signals[n], handler) == SIG_ERR) { fprintf(stderr, "%s: cannot set handler for signal %d\n", PACKAGE_NAME, signals[n]); fprintf(stderr, "%s: %s\n", PACKAGE_NAME, strerror(errno)); } } make_lock(force); atexit(at_exit); read_log(); current = first; initXwindow(xdisplay); createXBMfromXPM(wmwork_mask_bits, wmwork_master_xpm, 64, 64); openXwindow(argc, argv, wmwork_master_xpm, wmwork_mask_bits, 64, 64, geometry, NULL); AddMouseRegion(BUT_START, 5, 48, 22, 58); AddMouseRegion(BUT_PAUSE, 23, 48, 40, 58); AddMouseRegion(BUT_STOP, 41, 48, 58, 58); AddMouseRegion(BUT_PREV, 5, 33, 16, 43); AddMouseRegion(BUT_NEXT, 47, 33, 58, 43); drawTime(current->time, sess_time, microtm, show_days, running); drawProject(current->name); while (1) { last_time = now.tv_sec; gettimeofday(&now, &tz); if (running) { current->time += now.tv_sec - last_time; sess_time += now.tv_sec - last_time; microtm = now.tv_usec; drawTime(current->time, sess_time, microtm, show_days, running); RedrawWindow(); } while (XPending(display)) { XNextEvent(display, &Event); switch (Event.type) { case Expose: RedrawWindow(); break; case DestroyNotify: XCloseDisplay(display); exit(0); case ButtonPress: n = CheckMouseRegion(Event.xbutton.x, Event.xbutton.y); switch (n) { case BUT_START: case BUT_PAUSE: case BUT_STOP: case BUT_PREV: case BUT_NEXT: ButtonDown(n); break; } but_stat = n; RedrawWindow(); break; case ButtonRelease: n = CheckMouseRegion(Event.xbutton.x, Event.xbutton.y); switch (but_stat) { case BUT_START: case BUT_PAUSE: case BUT_STOP: case BUT_PREV: case BUT_NEXT: ButtonUp(but_stat); break; } if (but_stat && n == but_stat) { switch (but_stat) { case BUT_START: running = 1; break; case BUT_PAUSE: running = 0; break; case BUT_STOP: write_log(); write_record(); running = 0; sess_time = 0; break; case BUT_PREV: if (!running && sess_time == 0) current = current->prev; break; case BUT_NEXT: if (!running && sess_time == 0) current = current->next; break; } drawTime(current->time, sess_time, microtm, show_days, running); drawProject(current->name); } RedrawWindow(); but_stat = 0; break; } } usleep(50000L); if (do_exit) exit(0); } }