CHeaderView::CHeaderView(void) : m_MessageWindow(NULL), m_CurrentHeader(NULL) { // TODO: add new prefs items for these. m_TextColor = COLORVAL(item_headertext); m_BackColor = COLORVAL(item_headerbackground); }
void CServerListView::UpdateSettings( void ) { if (g_pPrefs) { m_tree.SetBkColor(COLORVAL(item_serverlistbackground)); m_tree.SetTextColor(COLORVAL(item_serverlistnormaltext)); m_tree.SetFont(GetAppFont(PREF_fServerListFont)); if (m_pToolTip) m_pToolTip.Activate(BOOLPREF(PREF_bServerListToolTips)); } m_tree.RedrawWindow(); }
LRESULT CTransfersView::OnNmCustomDraw(int idCtrl, LPNMHDR pnmh, BOOL& bHandled) { LPNMLVCUSTOMDRAW pNMH = (LPNMLVCUSTOMDRAW)pnmh; switch(pNMH->nmcd.dwDrawStage) { case CDDS_PREPAINT: return CDRF_NOTIFYITEMDRAW; case CDDS_ITEMPREPAINT: { CDCCTransfer *pDCCTransfer = (CDCCTransfer *)pNMH->nmcd.lItemlParam; //sys_Printf(BIC_INFO,"pNMH->nmcd.dwItemSpec == 0x%08x pNMH->nmcd.lItemlParam == 0x%08x\n",pNMH->nmcd.dwItemSpec, pNMH->nmcd.lItemlParam); // if these are the same then we're being told about column headers, if not // then we're being told about an item and dwItemSpec is the item index // gee thanks for the docs Microsoft, NOT! if ((DWORD) pNMH->nmcd.dwItemSpec == (DWORD) pNMH->nmcd.lItemlParam) return NULL; // don't care about the column headers if (!pDCCTransfer) return NULL;//CDRF_DODEFAULT ? switch(pDCCTransfer->m_Status) { case DCCT_STATUS_ERROR: pNMH->clrText = COLORVAL(item_transferlisterrortext); break; case DCCT_STATUS_COMPLETE: pNMH->clrText = COLORVAL(item_transferlistcompletetext); break; default: pNMH->clrText = COLORVAL(item_transferlistnormaltext); break; } pNMH->clrTextBk = COLORVAL(item_transferlistbackground); return NULL;//CDRF_NEWFONT; } break; } // shouldn't get here the return value is just to shut the compiler up. #ifdef DEBUG ATLASSERT(0); #endif return NULL; }
void CTransfersView::UpdateSettings( void ) { if (g_pPrefs) { m_TransfersListCtrl.SetBkColor(COLORVAL(item_transferlistbackground)); } }
LRESULT CServerListView::OnNmCustomDraw(int idCtrl, LPNMHDR pnmh, BOOL& bHandled) { LPNMTVCUSTOMDRAW pNMH = (LPNMTVCUSTOMDRAW)pnmh; switch(pNMH->nmcd.dwDrawStage) { case CDDS_PREPAINT: return CDRF_NOTIFYITEMDRAW; case CDDS_ITEMPREPAINT: { BOOL FontChanged = FALSE; COLORREF NewForeground = -1; COLORREF NewBackground = -1; TreeItemInfo *pTII = (TreeItemInfo *)pNMH->nmcd.lItemlParam; if (!pTII) return NULL; int DirtyStatus; switch(pTII->m_Type) { case TII_IRCSERVER: { COLORREF NewServerForeground = -1; IRCServer *pServer = (IRCServer *)pTII->m_Data; switch (pServer->GetStatus()) { case SVR_STATE_DISCONNECTED: NewForeground = COLORVAL(item_serverlistdisconnected); break; case SVR_STATE_CONNECTING: NewForeground = COLORVAL(item_serverlistconnecting); break; case SVR_STATE_CONNECTED: if (!pServer->IsLoggedIn()) NewForeground = COLORVAL(item_serverlistconnecting); else NewForeground = COLORVAL(item_serverlistconnected); break; } DirtyStatus = pServer->GetDirtyStatus(); if (DirtyStatus & DIRTY_RECENT) { NewServerForeground = COLORVAL(item_serverlistserverrecenttext); NewBackground = COLORVAL(item_serverlistserverrecentbackground); SelectObject(pNMH->nmcd.hdc,GetAppFont(PREF_fServerListRecentFont)); FontChanged=TRUE; } else { if (DirtyStatus & DIRTY_TRUE) { NewServerForeground = COLORVAL(item_serverlistserverdirtytext); NewBackground = COLORVAL(item_serverlistserverdirtybackground); SelectObject(pNMH->nmcd.hdc,GetAppFont(PREF_fServerListDirtyFont)); FontChanged=TRUE; } } if (NewServerForeground != -1) NewForeground = NewServerForeground; } break; case TII_DCCCHAT: { IRCServer *pServer = (IRCServer *)pTII->m_Data; DirtyStatus = pServer->GetDirtyStatus(); if (DirtyStatus & DIRTY_RECENT) { NewForeground = COLORVAL(item_serverlistdccchatrecenttext); NewBackground = COLORVAL(item_serverlistdccchatrecentbackground); SelectObject(pNMH->nmcd.hdc,GetAppFont(PREF_fServerListRecentFont)); FontChanged=TRUE; } else { if (DirtyStatus & DIRTY_TRUE) { NewForeground = COLORVAL(item_serverlistdccchatdirtytext); NewBackground = COLORVAL(item_serverlistdccchatdirtybackground); SelectObject(pNMH->nmcd.hdc,GetAppFont(PREF_fServerListDirtyFont)); FontChanged=TRUE; } } } break; case TII_IRCCHANNEL: { IRCChannel *pChannel = (IRCChannel *)pTII->m_Data; DirtyStatus = pChannel->GetDirtyStatus(); if (DirtyStatus & DIRTY_RECENT) { NewForeground = COLORVAL(item_serverlistchannelrecenttext); NewBackground = COLORVAL(item_serverlistchannelrecentbackground); SelectObject(pNMH->nmcd.hdc,GetAppFont(PREF_fServerListRecentFont)); FontChanged=TRUE; } else { if (DirtyStatus & DIRTY_TRUE) { NewForeground = COLORVAL(item_serverlistchanneldirtytext); NewBackground = COLORVAL(item_serverlistchanneldirtybackground); SelectObject(pNMH->nmcd.hdc,GetAppFont(PREF_fServerListDirtyFont)); FontChanged=TRUE; } } } break; case TII_QUERY: { IRCQuery *pQuery = (IRCQuery *)pTII->m_Data; DirtyStatus = pQuery->GetDirtyStatus(); if (DirtyStatus & DIRTY_RECENT) { NewForeground = COLORVAL(item_serverlistqueryrecenttext); NewBackground = COLORVAL(item_serverlistqueryrecentbackground); SelectObject(pNMH->nmcd.hdc,GetAppFont(PREF_fServerListRecentFont)); FontChanged=TRUE; } else { if (DirtyStatus & DIRTY_TRUE) { NewForeground = COLORVAL(item_serverlistquerydirtytext); NewBackground = COLORVAL(item_serverlistquerydirtybackground); SelectObject(pNMH->nmcd.hdc,GetAppFont(PREF_fServerListDirtyFont)); FontChanged=TRUE; } } } break; } if (NewForeground != -1) pNMH->clrText = NewForeground; // use a selected background color, if the item is selected if (pNMH->nmcd.uItemState & CDIS_SELECTED) NewBackground = COLORVAL(item_serverlistselectedbackground); if (NewBackground != -1) pNMH->clrTextBk = NewBackground; return FontChanged ? CDRF_NEWFONT : NULL; } } // shouldn't get here the return value is just to shut the compiler up. #ifdef DEBUG ATLASSERT(0); #endif return NULL; }
void triple_buffer(BITMAP **page) { int i = 0, w, repeat, active_page = 0; int time_diff, bar_number, *used_voices = NULL, hw_voices; int text_bar_height, half_bar_size; unsigned int radius; coord_t dot[2], dot_old[2], cal[2], cal_tmp[2]; wiimote *wiimote; char *fonts[NUM_MAX_FONTS] = FONTS; FONT *font_msg, *font_notes; BITMAP *background; bars *bar; /* dot_old data initialization. dot_old's X coord is not used */ dot_old[0].y = SCREEN_H; dot_old[1].y = SCREEN_H; /* Wiimote initialization*/ wiimote = *wiiuse_init(1); /* Load fonts, size of font is related to SCREEN_W */ do { font_msg = load_font(fonts[i], NULL, NULL); __ASSERT(font_msg, ERROR_CANT_LOAD_FONT(fonts[i])); w = text_length(font_msg, WIIMOTE_CONNECTION_MSG); } while (w >= SCREEN_W && ++i < (NUM_MAX_FONTS-1)); /* Notes' font is smaller than messages' font */ font_notes = load_font(fonts[i], NULL, NULL); __ASSERT(font_notes, ERROR_CANT_LOAD_FONT(fonts[i])); /* Initialize and calculate bars size, point radius, text bar height, and calculate half bar size for text output under bars */ bar = bar_create(NUM_BARS); radius = RADIUS(bar); text_bar_height = TEXT_BAR_HEIGHT; half_bar_size = HALF_BAR_SIZE(bar); /* Control the max number of available hardware voices. Though ALSA driver voices are up to 64, max hardware voices generally are 8-16. Checking the allocated voices after the driver allocation seems to be the only way */ hw_voices = get_mixer_voices(); if (hw_voices < NUM_BARS) used_voices = reallocate_voices(bar, hw_voices); /* Install timer, 10 ticks a second */ LOCK_VARIABLE(timer); LOCK_FUNCTION(inc_timer); install_int_ex(inc_timer, BPS_TO_TIMER(10)); /* Load background from file */ background = load_tga("images/back.tga", NULL); __ASSERT(background, ERROR_CANT_LOAD_IMAGE("back.tga")); /* Enables vertical syncronization*/ vsync(); i = 0; /* First frame, this lasts until wiimote is connected, the user is prompted to activate the wiimote by pressing 1 & 2 keys on the wiimote */ while(i == 0 && !keypressed()) { active_page = start_credits3buf(page, active_page); clear_keybuf(); title3buf(page, active_page, font_msg); clear_keybuf(); repeat = 0; while(repeat++ < 8 && i == 0 && !keypressed()) { stretch_blit(background, page[active_page], 0, 0, background->w, background->h, 0, 0, SCREEN_W, SCREEN_H); // background if(repeat%2 == 1) textout_centre_ex(page[active_page], font_msg, WIIMOTE_CONNECTION_MSG, SCREEN_W/2, SCREEN_H/2, makecol(0, 0, 0), -1); // text prompt release_bitmap(page[active_page]); /* make sure the last flip request has actually happened */ do { } while (poll_scroll()); /* post a request to display the page we just drew */ request_video_bitmap(page[active_page]); /* update counters to point to the next page */ switch (active_page) { case 0: active_page = 1; break; case 1: active_page = 2; break; case 2: active_page = 0; break; } /* Search for a wiimote */ i = wiiuse_find(&wiimote, 1, 1); } } /* Try to connect to the wiimote */ __ASSERT(wiiuse_connect(&wiimote, 1) > 0, ERROR_CANT_OPEN_WIIMOTE); /* Activate the first led on the wiimote */ wiiuse_set_leds(wiimote, WIIMOTE_LED_1); /* Activate the ir module on the wiimote */ wiiuse_set_ir(wiimote, TRUE); wiiuse_motion_sensing(wiimote, FALSE); wiiuse_set_ir_sensitivity(wiimote, 1); wiiuse_set_flags(wiimote, WIIUSE_CONTINUOUS, 0); cal[0].x = 0; cal[0].y = 0; cal[1].x = 1023; cal[1].y = 767; /* CALIBRATION LOOP */ for(repeat=0;repeat<2;repeat++) { clear_keybuf(); while(!keypressed()) { if (wiiuse_poll(&wiimote, 1)) // if there are datas pending from/to wiimote or ESC is pressed if (key[KEY_ESC] || wiimote->event == WIIUSE_DISCONNECT || wiimote->event == WIIUSE_UNEXPECTED_DISCONNECT || IS_PRESSED(wiimote, WIIMOTE_BUTTON_HOME)) { // if ESC is pressed, if wiimote update fails, or if HOME key on wiimote is pressed wiiuse_disconnect(wiimote); destroy_bitmap(background); destroy_font(font_msg); destroy_font(font_notes); for (i=0;i<NUM_BARS;i++) { deallocate_voice(bar[i].voice); destroy_sample(bar[i].sound); } free(bar); // YO!! :-) free(used_voices); return; } /* background */ stretch_blit(background, page[active_page], 0, 0, background->w, background->h, 0, 0, SCREEN_W, SCREEN_H); if (wiimote->ir.dot[0].visible) { // if ir source is visible /* Read coords from the wiimote's ir*/ dot[0] = transpose(wiimote->ir.dot[0], cal, 0); } switch(repeat) { case 0: textout_centre_ex(page[active_page], font_msg, WIIMOTE_CAL_ASX, SCREEN_W/2, SCREEN_H/2, makecol(0, 0, 0), -1); // text prompt rect(page[active_page], dot[0].x, dot[0].y, SCREEN_W+1, SCREEN_H+1, makecol(0, 0, 0)); break; case 1: textout_centre_ex(page[active_page], font_msg, WIIMOTE_CAL_BDX, SCREEN_W/2, SCREEN_H/2, makecol(0, 0, 0), -1); // text prompt rect(page[active_page], dot[1].x, dot[1].y, SCREEN_W+1, SCREEN_H+1, makecol(0, 0, 0)); rect(page[active_page], -1, -1, dot[0].x, dot[0].y, makecol(0, 0, 0)); break; } circlefill(page[active_page], dot[0].x, dot[0].y, radius, makecol(0, 0, 0)); release_bitmap(page[active_page]); /* make sure the last flip request has actually happened */ do { } while (poll_scroll()); /* post a request to display the page we just drew */ request_video_bitmap(page[active_page]); /* update counters to point to the next page */ switch (active_page) { case 0: active_page = 1; break; case 1: active_page = 2; break; case 2: active_page = 0; break; } } cal_tmp[repeat].x = wiimote->ir.dot[0].x; cal_tmp[repeat].y = wiimote->ir.dot[0].y; dot[1] = dot[0]; } __ASSERT((cal_tmp[0].x < cal_tmp[1].x && cal_tmp[0].y > cal_tmp[1].y), ERROR_WHILE_CALIBRATING); cal[0].x = cal_tmp[0].x; cal[0].y = 767-cal_tmp[0].y; cal[1].x = cal_tmp[1].x; cal[1].y = 767-cal_tmp[1].y; /* MAIN LOOP */ while (TRUE) { /* Draw a frame */ if (wiiuse_poll(&wiimote, 1) || key[KEY_ESC]) // if there are datas pending from/to wiimote or ESC is pressed if (key[KEY_ESC] || wiimote->event == WIIUSE_DISCONNECT || wiimote->event == WIIUSE_UNEXPECTED_DISCONNECT || IS_PRESSED(wiimote, WIIMOTE_BUTTON_HOME)) { // if ESC is pressed, if wiimote update fails, or if HOME key on wiimote is pressed wiiuse_disconnect(wiimote); destroy_bitmap(background); destroy_font(font_msg); destroy_font(font_notes); for (i=0;i<NUM_BARS;i++) { deallocate_voice(bar[i].voice); destroy_sample(bar[i].sound); } free(bar); // YO!! :-) free(used_voices); return; } /* background */ stretch_blit(background, page[active_page], 0, 0, background->w, background->h, 0, 0, SCREEN_W, SCREEN_H); /* Xylophone's bars and notes names */ for(i=0;i<NUM_BARS;i++) { if (bar[i].t_start != -1 && (time_diff = timer-bar[i].t_start) > TICKS_TO_BLACK) // if color animation ends bar[i].t_start = -1; if (bar[i].t_start == -1) // if no color animation bar[i].color = 0; else bar[i].color = COLORVAL(time_diff); // if color animation is running /* Draw bar */ rectfill(page[active_page], bar[i].min.x, bar[i].min.y, bar[i].max.x, bar[i].max.y, makecol(bar[i].color, bar[i].color, bar[i].color)); /* Print bar's associated note */ textout_centre_ex(page[active_page], font_notes, bar[i].note, (bar[i].min.x + half_bar_size), text_bar_height, makecol(0, 0, 0), -1); } // da normalizzare e da contenere nello schermo, ir for(i=0;i<MAX_IR_DOTS;i++) { if (wiimote->ir.dot[i].visible) { // if ir source is visible /* Read coords from the wiimote's ir*/ dot[i] = transpose(wiimote->ir.dot[i], cal, radius); /* If the ir source is under the bars and in previous frame it was above the bars, then play the sound and start the animation */ if (dot[i].y > bar[0].min.y-radius) { if(dot_old[i].y <= bar[0].min.y-radius) { /* This calculates on which bar the ir source actually is */ bar_number = is_onbar(bar, dot[i].x, NUM_BARS); /* play bar_number's sound with specified volume */ play_bar_voice(bar, bar_number, volume(dot[i].y-dot_old[i].y), used_voices, hw_voices); } /* The dot have not to go under the bars or out of the screen */ circlefill(page[active_page], dot[i].x, bar[0].min.y-radius, radius, makecol(0, 0, 0)); } else circlefill(page[active_page], dot[i].x, dot[i].y, radius, makecol(0, 0, 0)); dot_old[i].y = dot[i].y; } else dot_old[i].y = SCREEN_H; } release_bitmap(page[active_page]); /* make sure the last flip request has actually happened */ do { } while (poll_scroll()); /* post a request to display the page we just drew */ request_video_bitmap(page[active_page]); /* update counters to point to the next page */ switch (active_page) { case 0: active_page = 1; break; case 1: active_page = 2; break; case 2: active_page = 0; break; } } }
/** * \brief Parse command line style overrides (--ass-force-style option) * \param track track to apply overrides to * The format for overrides is [StyleName.]Field=Value */ void ass_process_force_style(ASS_Track *track) { char **fs, *eq, *dt, *style, *tname, *token; ASS_Style *target; int sid; char **list = track->library->style_overrides; if (!list) return; for (fs = list; *fs; ++fs) { eq = strrchr(*fs, '='); if (!eq) continue; *eq = '\0'; token = eq + 1; if (!strcasecmp(*fs, "PlayResX")) track->PlayResX = atoi(token); else if (!strcasecmp(*fs, "PlayResY")) track->PlayResY = atoi(token); else if (!strcasecmp(*fs, "Timer")) track->Timer = ass_atof(token); else if (!strcasecmp(*fs, "WrapStyle")) track->WrapStyle = atoi(token); else if (!strcasecmp(*fs, "ScaledBorderAndShadow")) track->ScaledBorderAndShadow = parse_bool(token); else if (!strcasecmp(*fs, "Kerning")) track->Kerning = parse_bool(token); dt = strrchr(*fs, '.'); if (dt) { *dt = '\0'; style = *fs; tname = dt + 1; } else { style = NULL; tname = *fs; } for (sid = 0; sid < track->n_styles; ++sid) { if (style == NULL || strcasecmp(track->styles[sid].Name, style) == 0) { target = track->styles + sid; if (0) { STRVAL(FontName) COLORVAL(PrimaryColour) COLORVAL(SecondaryColour) COLORVAL(OutlineColour) COLORVAL(BackColour) FPVAL(FontSize) INTVAL(Bold) INTVAL(Italic) INTVAL(Underline) INTVAL(StrikeOut) FPVAL(Spacing) INTVAL(Angle) INTVAL(BorderStyle) INTVAL(Alignment) INTVAL(MarginL) INTVAL(MarginR) INTVAL(MarginV) INTVAL(Encoding) FPVAL(ScaleX) FPVAL(ScaleY) FPVAL(Outline) FPVAL(Shadow) } } } *eq = '='; if (dt) *dt = '.'; }