Beispiel #1
0
static int CustomDrawNewFile(HWND hwnd, LPNMLVCUSTOMDRAW draw)
{
    HWND hwndLV;
    switch(draw->nmcd.dwDrawStage)
    {
        case CDDS_PREPAINT :
        case CDDS_ITEMPREPAINT:
            return CDRF_NOTIFYSUBITEMDRAW;
        case CDDS_ITEMPREPAINT | CDDS_SUBITEM:
            hwndLV = GetDlgItem(hwnd, IDC_LVNEWPROJECT);
            // we do it this way so the selection won't go away when we focus another control
            if (ListView_GetItemState(hwndLV, draw->nmcd.dwItemSpec, LVIS_SELECTED) & LVIS_SELECTED)
            {
                draw->clrText = RetrieveSysColor(COLOR_HIGHLIGHTTEXT);
                draw->clrTextBk = RetrieveSysColor(COLOR_HIGHLIGHT);
            }
            else
            {
                draw->clrText = RetrieveSysColor(COLOR_WINDOWTEXT);
                draw->clrTextBk = RetrieveSysColor(COLOR_WINDOW);
            }
            return CDRF_NEWFONT;
        default:
            return CDRF_DODEFAULT;
    }
}
Beispiel #2
0
//-------------------------------------------------------------------------
static int CustomDraw(HWND hwnd, LPNMTVCUSTOMDRAW draw)
{
    PROJECTITEM *p;
    switch(draw->nmcd.dwDrawStage)
    {
        case CDDS_PREPAINT :
            return CDRF_NOTIFYITEMDRAW ;
        case CDDS_ITEMPREPAINT:
            p = (PROJECTITEM *)draw->nmcd.lItemlParam;
            if (p->type == PJ_PROJ && !p->loaded)
            {
                draw->clrText= RetrieveSysColor(COLOR_GRAYTEXT);
                draw->clrTextBk = RetrieveSysColor(COLOR_WINDOW);
                SelectObject(draw->nmcd.hdc, italicProjFont);
                return CDRF_NEWFONT;
            }
            else
            {
                if (activeProject == p)
                {
                    SelectObject(draw->nmcd.hdc, boldProjFont);
                    return CDRF_NEWFONT;    
                }
                else if (((PROJECTITEM *)draw->nmcd.lItemlParam)->hTreeItem == TreeView_GetDropHilight(prjTreeWindow))
                {
                    draw->clrText= RetrieveSysColor(COLOR_HIGHLIGHTTEXT);
                    draw->clrTextBk = RetrieveSysColor(COLOR_HIGHLIGHT);
                }
                else if (draw->nmcd.uItemState & (CDIS_SELECTED ))
                {
                    draw->clrText= RetrieveSysColor(COLOR_HIGHLIGHT);
                    draw->clrTextBk = RetrieveSysColor(COLOR_WINDOW);
                }
                else if (draw->nmcd.uItemState & (CDIS_HOT))
                {
                    draw->clrText= RetrieveSysColor(COLOR_INFOTEXT);
                    draw->clrTextBk = RetrieveSysColor(COLOR_INFOBK);
                }
                else if (draw->nmcd.uItemState == 0)
                {
                    draw->clrText= RetrieveSysColor(COLOR_WINDOWTEXT);
                    draw->clrTextBk = RetrieveSysColor(COLOR_WINDOW);
                }
                SelectObject(draw->nmcd.hdc, projFont);
                return CDRF_NEWFONT;    
            }
            return CDRF_DODEFAULT;
        default:
            return CDRF_DODEFAULT;
    }
}
Beispiel #3
0
void CreateMenuBitmaps(void)
{
    HBITMAP bitmaps[sizeof(MenuBitmapIDs)/sizeof(int)];
    HDC hDC = GetDC(hwndFrame);
    int i;
    for (i=0; i < sizeof(MenuBitmapIDs)/sizeof(int); i++)
    {
        bitmaps[i] = LoadBitmap(hInstance, (LPTSTR)MenuBitmapIDs[i]);
    }


    for (i=0; i < sizeof(MenuBitmaps)/ sizeof(struct menuBitmap); i++)
    {
        DWORD n = GetVersion();
        if (LOBYTE(LOWORD(n)) >= 6)
        {
            // windows 7 or later, use transparent bitmaps
            MenuBitmaps[i].bitmap = ConvertToTransparent(CopyBitmap(hwndFrame, bitmaps[MenuBitmaps[i].bitmapNum],
                        MenuBitmaps[i].submapNum * 16, 0 , 16, 16), 0xc0c0c0);		
        }
        else
        {   
            // windows XP or earlier, change the bitmap background...
            MenuBitmaps[i].bitmap = CopyBitmap(hwndFrame, bitmaps[MenuBitmaps[i].bitmapNum],
                        MenuBitmaps[i].submapNum * 16, 0 , 16, 16);
            ChangeBitmapColor(MenuBitmaps[i].bitmap, 0xc0c0c0, RetrieveSysColor(COLOR_MENU));
        }
    }
    
    for (i=0; i < sizeof(MenuBitmapIDs)/sizeof(int); i++)
        DeleteObject(bitmaps[i]);
    ReleaseDC(hwndFrame, hDC);
}
Beispiel #4
0
static void DrawFrame(HDC dc, RECT *r, int vertical)
{
    HBRUSH brush, oldbrush;
    HPEN pen1, pen2, oldpen;
    pen1 = CreatePen(PS_SOLID, 2, RetrieveSysColor(COLOR_BTNHIGHLIGHT));
    pen2 = CreatePen(PS_SOLID, 1, RetrieveSysColor(COLOR_BTNSHADOW));
    brush = CreateSolidBrush(RetrieveSysColor(COLOR_BTNFACE));
    oldbrush = SelectObject(dc, brush);
    FillRect(dc, r, brush);

/*
    oldpen = SelectObject(dc, pen1);
    MoveToEx(dc, r->left, r->top, 0);
    LineTo(dc, r->right, r->top);

    SelectObject(dc, pen2);


    if (vertical)
    {
        SelectObject(dc, pen1);
        MoveToEx(dc, r->left, r->top + 1, 0);
        LineTo(dc, r->left, r->bottom - 2);

        SelectObject(dc, pen2);
        MoveToEx(dc, r->right - 1, r->top, 0);
        LineTo(dc, r->right - 1, r->bottom - 1);
    }
    else
    {
        SelectObject(dc, pen1);
        MoveToEx(dc, r->left + 1, r->top, 0);
        LineTo(dc, r->right - 1, r->top);

        SelectObject(dc, pen2);
        MoveToEx(dc, r->left + 1, r->bottom - 1, 0);
        LineTo(dc, r->right - 1, r->bottom - 1);
    }
    SelectObject(dc, oldpen);
    SelectObject(dc, oldbrush);
    */
    DeleteObject(pen1);
    DeleteObject(pen2);
    DeleteObject(brush);
}
Beispiel #5
0
static int CustomDraw(HWND hwnd, LPNMLVCUSTOMDRAW draw)
{
    switch(draw->nmcd.dwDrawStage)
    {
        case CDDS_PREPAINT :
        case CDDS_ITEMPREPAINT:
            return CDRF_NOTIFYSUBITEMDRAW;
        case CDDS_ITEMPREPAINT | CDDS_SUBITEM:
            if (draw->nmcd.uItemState & (CDIS_SELECTED ))
            {
                draw->clrText = RetrieveSysColor(COLOR_HIGHLIGHTTEXT);
                draw->clrTextBk = RetrieveSysColor(COLOR_HIGHLIGHT);
            }
            else
            {
                draw->clrText = RetrieveSysColor(COLOR_WINDOWTEXT);
                draw->clrTextBk = RetrieveSysColor(COLOR_WINDOW);
            }
            return CDRF_NEWFONT;
        default:
            return CDRF_DODEFAULT;
    }
}
Beispiel #6
0
static int CustomDraw(HWND hwnd, BOOLEAN showingBuildOrder, PROJECTITEM *proj, LPNMLVCUSTOMDRAW draw)
{
    switch(draw->nmcd.dwDrawStage)
    {
        case CDDS_PREPAINT :
        case CDDS_ITEMPREPAINT:
            return CDRF_NOTIFYSUBITEMDRAW;
        case CDDS_ITEMPREPAINT | CDDS_SUBITEM:
            if (!showingBuildOrder && CircularDepends(proj, (PROJECTITEM *)draw->nmcd.lItemlParam))
            {
                draw->clrText = 0x888888;
                draw->clrTextBk = RetrieveSysColor(COLOR_WINDOW);
            }
            else
            {
                draw->clrText = RetrieveSysColor(COLOR_WINDOWTEXT);
                draw->clrTextBk = RetrieveSysColor(COLOR_WINDOW);
            }
            return CDRF_NEWFONT;
        default:
            return CDRF_DODEFAULT;
    }
}
Beispiel #7
0
HWND CreateStackWindow(void)
{
    if (hwndStack)
    {
        SendMessage(hwndStack, WM_SETFOCUS, 0, 0);
    }
    else
    {
        HBITMAP bitmap;
        bitmap = LoadBitmap(hInstance, "ID_TAG");
        ChangeBitmapColor(bitmap, 0xc0c0c0, RetrieveSysColor(COLOR_WINDOW));
        tagImageList = ImageList_Create(16, 16, ILC_COLOR24, ILEDIT_IMAGECOUNT, 0);
        ImageList_Add(tagImageList, bitmap, NULL);
        DeleteObject(bitmap);
        hwndStack = CreateDockableWindow(DID_STACKWND, szStackClassName, szStackTitle, hInstance, 30 * 8, 19 * 8);
    }
    return hwndStack;
}
Beispiel #8
0
void RegisterMenuDrawWindow(void)
{
    WNDCLASS wc;
    memset(&wc, 0, sizeof(wc));
    wc.style = CS_DBLCLKS;
    wc.lpfnWndProc = &MenuDrawProc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = sizeof(void*) * 2;
    wc.hInstance = hInstance;
    wc.hIcon = LoadIcon(0, IDI_APPLICATION);
    wc.hCursor = LoadCursor(0, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)(COLOR_APPWORKSPACE + 1);
    wc.lpszMenuName = 0;
    wc.lpszClassName = szMenuDrawClassName;
    RegisterClass(&wc);
    arrImage = LoadImage(hInstance, "ID_RIGHTARR", IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
    ChangeBitmapColor(arrImage, 0xc0c0c0, RetrieveSysColor(COLOR_BTNFACE));
    dragCur = LoadCursor(hInstance, "ID_DRAGCTL");
    noCur = LoadCursor(hInstance, "ID_NODRAGCUR");
}
Beispiel #9
0
void RegisterThreadWindow(HINSTANCE hInstance)
{
    WNDCLASS wc;
    HBITMAP bitmap;
    memset(&wc, 0, sizeof(wc));
    wc.style = CS_HREDRAW + CS_VREDRAW + CS_DBLCLKS;
    wc.lpfnWndProc = &ThreadProc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hInstance = hInstance;
    wc.hIcon = LoadIcon(0, IDI_APPLICATION);
    wc.hCursor = LoadCursor(0, IDC_ARROW);
    wc.hbrBackground = 0; // GetStockObject(WHITE_BRUSH);
    wc.lpszMenuName = 0;
    wc.lpszClassName = szThreadClassName;
    RegisterClass(&wc);

    bitmap = LoadBitmap(hInstance, "ID_TAG");
    ChangeBitmapColor(bitmap, 0xc0c0c0, RetrieveSysColor(COLOR_WINDOW));
    tagImageList = ImageList_Create(16, 16, ILC_COLOR24, ILEDIT_IMAGECOUNT, 0);
    ImageList_Add(tagImageList, bitmap, NULL);
    DeleteObject(bitmap);
}
Beispiel #10
0
LRESULT CALLBACK ProjectProc(HWND hwnd, UINT iMessage, WPARAM wParam,
    LPARAM lParam)
{
    int i;
    RECT rs;
    NM_TREEVIEW *nm;
    DWINFO info;
    LPNMTVKEYDOWN key;
    PROJECTITEM *data;
    TVHITTESTINFO hittest;
    HWND win;
    HTREEITEM oldSel;
    static HCURSOR origCurs;
    static BOOL dragging;
    static BOOL inView;
    static HTREEITEM srcItem, dstItem;
    switch (iMessage)
    {
        LOGFONT lf;
        case WM_SYSCOMMAND:
            if (wParam == SC_CLOSE)
                SendMessage(hwnd, WM_CLOSE, 0, 0);
            break;
//        case WM_SETTEXT:
//            return SendMessage(hwndTab, iMessage, wParam, lParam);
        case WM_LBUTTONDOWN:
        case WM_RBUTTONDOWN:
            SetFocus(hwnd);
            break;
        case WM_NOTIFY:
            nm = (NM_TREEVIEW*)lParam;
            switch (nm->hdr.code)
            {
            case NM_CUSTOMDRAW:
                return CustomDraw(hwnd, (LPNMTVCUSTOMDRAW)nm);
            case N_EDITDONE:
                DoneRenaming();
                break;
            case TVN_BEGINDRAG:
                GetCursorPos(&hittest.pt);
                ScreenToClient(prjTreeWindow, &hittest.pt);
                srcItem = TreeView_HitTest(prjTreeWindow, &hittest);
                data = GetItemInfo(srcItem);
                if (data && (data->type == PJ_FILE || data->type == PJ_FOLDER))
                {
                    dragging = TRUE;
                    SetCapture(hwnd);
                    origCurs = SetCursor(dragCur);
                    inView = TRUE;
                }
                break;
            case TVN_KEYDOWN:
                key = (LPNMTVKEYDOWN)lParam;
                switch (key->wVKey)
                {
                    case VK_INSERT:
                        if (GetKeyState(VK_CONTROL) &0x80000000)
                        {
                            data = GetItemInfo(prjSelectedItem);
                            if (data)
                            {
                                int msg = -1;
                                switch (data->type)
                                {
                                    case PJ_WS:
                                        msg = IDM_EXISTINGPROJECT;
                                        break;
                                    case PJ_PROJ:
                                        msg = IDM_NEWFOLDER;
                                        break;
                                    case PJ_FOLDER:
                                        msg = IDM_EXISTINGFILE;
                                        break;
                                }
                                if (msg != -1)
                                    PostMessage(hwnd, WM_COMMAND, msg, 0);
                            }
                        }
                        else if (GetKeyState(VK_SHIFT) &0x80000000)
                        {
                            data = GetItemInfo(prjSelectedItem);
                            if (data)
                            {
                                int msg = -1;
                                switch (data->type)
                                {
                                    case PJ_WS:
                                        msg = IDM_NEWPROJECT;
                                        break;
                                    case PJ_PROJ:
                                        msg = IDM_NEWFOLDER;
                                        break;
                                    case PJ_FOLDER:
                                        msg = IDM_NEWFILE_P;
                                        break;
                                }
                                if (msg != -1)
                                    PostMessage(hwnd, WM_COMMAND, msg, 0);
                            }
                        }
                        else 
                        {
                            data = GetItemInfo(prjSelectedItem);
                            if (data && (data->type != PJ_WS))
                                PostMessage(hwnd, WM_COMMAND, IDM_RENAME, 0);
                        }
                        break;
                    case VK_DELETE:
                        if (!(GetKeyState(VK_CONTROL) &0x80000000) && !(GetKeyState(VK_SHIFT) &0x8000000))
                        {
                            data = GetItemInfo(prjSelectedItem);
                            if (data && (data->type == PJ_FOLDER || data->type == PJ_FILE))
                                PostMessage(hwnd, WM_COMMAND, IDM_REMOVE, 0);
                        }
                        break;
                    case VK_RETURN:
                        SendMessage(hwnd, WM_COMMAND, IDM_OPENFILES, 0);
                        break;
                    }
                    break;
                case NM_DBLCLK:
                    oldSel = prjSelectedItem;
                    GetCursorPos(&hittest.pt);
                    ScreenToClient(prjTreeWindow, &hittest.pt);
                    prjSelectedItem = TreeView_HitTest(prjTreeWindow, &hittest);
                    if (prjSelectedItem)
                        PostMessage(hwnd, WM_COMMAND, IDM_OPENFILES, 0);
                    prjSelectedItem = oldSel;
                    return 0;
                case NM_RCLICK:
                    GetCursorPos(&hittest.pt);
                    ScreenToClient(prjTreeWindow, &hittest.pt);
                    prjSelectedItem = TreeView_HitTest(prjTreeWindow, &hittest);
                    if (prjSelectedItem)
                    {
                        TreeView_SelectItem(prjTreeWindow, prjSelectedItem);
                    }
                    CreateProjectMenu();
                    break;
                case TVN_SELCHANGED:
                    nm = (NM_TREEVIEW*)lParam;
                    prjSelectedItem = nm->itemNew.hItem;
                    if (prjSelectedItem == 0)
                        prjSelectedItem = workArea->hTreeItem;
                    break;
                case TVN_ITEMEXPANDED:
                    nm = (NM_TREEVIEW *)lParam;
                    data = GetItemInfo(nm->itemNew.hItem);
                    if (data)
                    {
                        if (data->type == PJ_FOLDER)
                        {
                            TV_ITEM setitem;
                            memset(&setitem, 0, sizeof(setitem));
                            setitem.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE;
                            setitem.iImage = setitem.iSelectedImage = 
                                nm->action == TVE_EXPAND ? ilfolderOpen : ilfolderClose;
                            setitem.hItem = nm->itemNew.hItem;
                            TreeView_SetItem(prjTreeWindow, &setitem);
                        }
                        if (nm->action == TVE_EXPAND)
                        {
                            data->expanded = TRUE;
                        }
                        else
                            data->expanded = FALSE;
                        return 0;
                    }
                    break;
                case TVN_DELETEITEM:
                    nm = (NM_TREEVIEW *)lParam;
                    if (nm->itemOld.hItem == prjSelectedItem)
                        prjSelectedItem = TreeView_GetSelection(prjTreeWindow);
                    break;
            }
            break;
        case WM_COMMAND:
            switch (LOWORD(wParam))
            {
                case ID_TBPROFILE:
                    if (HIWORD(wParam) == CBN_SELENDOK)
                    {
                        int i = SendMessage(hwndTbProfile, CB_GETCURSEL, 0 , 0);
                        if (i != CB_ERR)
                        {
                            if (i == 0)
                            {
                                strcpy(currentProfileName, sysProfileName);
                            }
                            else
                            {
                                PROFILENAMELIST *pf = profileNames;
                                while (pf && --i)
                                    pf = pf->next;
                                if (pf)
                                {
                                    strcpy(currentProfileName, pf->name);
                                }
                            }
                            MarkChanged(workArea, TRUE);
                        }
                    }
                    break;
                case ID_TBBUILDTYPE:
                    if (HIWORD(wParam) == CBN_SELENDOK)
                    {
                        int i = SendMessage(hwndTbBuildType, CB_GETCURSEL, 0 , 0);
                        if (i != CB_ERR)
                        {
                            profileDebugMode = i == 0 ? 1 : 0;
                            MarkChanged(workArea, TRUE);
                        }
                    }
                    break;
                case IDM_RESETPROFILECOMBOS:
                {
                    HWND htemp;
                    PROFILENAMELIST *pf;
                    int selected,n;
                    int count;
                    POINT pt;
                    pf = profileNames;
                    selected = 0;
                    count = 0;
                    SendMessage(hwndTbProfile, CB_RESETCONTENT, 0, 0);
                    SendMessage(hwndTbProfile, CB_ADDSTRING, 0, (LPARAM)sysProfileName);
                    while (pf)
                    {
                        count++;
                        if (!strcmp(pf->name,currentProfileName))
                            selected = count;
                        SendMessage(hwndTbProfile, CB_ADDSTRING, 0, (LPARAM)pf->name);
                            
                        pf = pf->next;
                            
                    }
                    SendMessage(hwndTbProfile, CB_SETCURSEL, selected, 0);
                    SendMessage(hwndTbBuildType, CB_RESETCONTENT, 0, 0);
                    SendMessage(hwndTbBuildType, CB_ADDSTRING, 0, (LPARAM)"Debug");
                    SendMessage(hwndTbBuildType, CB_ADDSTRING, 0, (LPARAM)"Release");
                    SendMessage(hwndTbBuildType, CB_SETCURSEL, profileDebugMode ? 0 : 1, 0);
                    
                    pt.x = 5;
                    pt.y = 5;
                    htemp = ChildWindowFromPoint(hwndTbProfile, pt);
                    SendMessage(htemp, EM_SETREADONLY, 1, 0);
                    htemp = ChildWindowFromPoint(hwndTbBuildType, pt);
                    SendMessage(htemp, EM_SETREADONLY, 1, 0);
                    EnableWindow(hwndTbProfile, TRUE);
                    EnableWindow(hwndTbBuildType, TRUE);
                    break;
                }
            case IDM_IMPORT_CWS:
                ImportProject(FALSE);
                break;
            case IDM_IMPORT_CTG:
                ImportProject(TRUE);
                break;
            case IDM_DOSWINDOW:
            {
                DosWindow(activeProject ? activeProject->realName : NULL, NULL, NULL, NULL, NULL);
            }
                break;
            case IDM_MAKEWINDOW:
            {
                char exec[MAX_PATH];
                sprintf(exec, "%s\\bin\\imake.exe", szInstallPath);
                DosWindow(activeProject ? activeProject->realName : NULL, exec, "", "Custom Make", "Make Is Complete.");
            }
                break;
            case IDM_RUN:
                SaveWorkArea(workArea);
                dbgRebuildMain(wParam);
                break;
            case IDM_SETACTIVEPROJECT:
                ProjectSetActive();
                break;
            case IDM_NEWFILE_P:
                ProjectNewFile();
                PostMessage(hwndFrame, WM_REDRAWTOOLBAR, 0, 0);
                break;
            case IDM_EXISTINGFILE:
                ProjectExistingFile();
                PostMessage(hwndFrame, WM_REDRAWTOOLBAR, 0, 0);
                break;
            case IDM_NEWPROJECT:
                ProjectNewProject();
                PostMessage(hwndFrame, WM_REDRAWTOOLBAR, 0, 0);
                break;
            case IDM_EXISTINGPROJECT:
                ProjectExistingProject();
                PostMessage(hwndFrame, WM_REDRAWTOOLBAR, 0, 0);
                break ;
            case IDM_REMOVE:
                ProjectRemove();
                PostMessage(hwndFrame, WM_REDRAWTOOLBAR, 0, 0);
                break;
            case IDM_RENAME:
                ProjectRename();
                break;
            case IDM_NEWFOLDER:
                ProjectNewFolder();
                PostMessage(hwndFrame, WM_REDRAWTOOLBAR, 0, 0);
                break;
            case IDM_NEWWS:
                if (uState != notDebugging)
                {
                    if (ExtendedMessageBox("WorkArea", MB_OKCANCEL, 
                        "This action requires the debugger to be stopped.") != IDOK)
                    {
                        break;
                    }
                    abortDebug();
                }
                SelectWindow(DID_PROJWND);
                ProjectNewWorkArea();
                break;
            case IDM_OPENWS:
                if (uState != notDebugging)
                {
                    if (ExtendedMessageBox("WorkArea", MB_OKCANCEL, 
                        "This action requires the debugger to be stopped.") != IDOK)
                    {
                        break;
                    }
                    abortDebug();
                }
                SelectWindow(DID_PROJWND);
                ProjectExistingWorkArea();
                break;
            case IDM_CLOSEWS:
                if (making)
                    break;
                if (uState != notDebugging)
                {
                    if (ExtendedMessageBox("WorkArea", MB_OKCANCEL, 
                        "This action requires the debugger to be stopped.") != IDOK)
                    {
                        break;
                    }
                    abortDebug();
                }
                CloseWorkArea();
                break;
            case IDM_SAVEWS:
                SaveAllProjects(workArea, TRUE);
                break;
            case IDM_COMPILEFILEFROMTREE:
            {
                PROJECTITEM *data = GetItemInfo(prjSelectedItem);
                if (data && data->type == PJ_FILE) 
                {
                    unlink(data->outputName);
                    Maker(data, TRUE);
                }        
            }
                break;
            case IDM_COMPILEFILE:
                win = (HWND)SendMessage(hwndClient, WM_MDIGETACTIVE, 0, 0);
                if (IsWindow(win) && IsEditWindow(win))
                {
                    HTREEITEM item = FindItemByWind(win);
                    PROJECTITEM *data = GetItemInfo(item);
                    if (data) {
                        unlink(data->outputName);
                        Maker(data, TRUE);
                    }
                }
                break;
            case IDM_GENMAKE:
                if (workArea && workArea->children)
                {
                    genMakeFile(workArea);
                }
                else
                {
                    ExtendedMessageBox("Makefile Generation", MB_SETFOREGROUND |
                        MB_SYSTEMMODAL, 
                        "You need at least one project to generate a make file");
                }
                break;
            case IDM_MAKE:
                if (HIWORD(wParam))
                    if (GetKeyState(VK_CONTROL) &0x80000000)
                        SendMessage(hwnd, WM_COMMAND, IDM_COMPILEFILE, 0);
                    else if (GetKeyState(VK_SHIFT) &0x80000000)
                        Maker(activeProject, FALSE);
                    else
                        Maker(workArea, FALSE);
                else
                    Maker(workArea, FALSE);
                break;                
            case IDM_MAKE_RIGHTCLICK:
                if (HIWORD(wParam))
                    if (GetKeyState(VK_CONTROL) &0x80000000)
                        SendMessage(hwnd, WM_COMMAND, IDM_COMPILEFILE, 0);
                    else if (GetKeyState(VK_SHIFT) &0x80000000)
                        Maker(activeProject, FALSE);
                    else
                        Maker(workArea, FALSE);
                else
                {
                    if (prjSelectedItem)
                    {
                        PROJECTITEM *data = GetItemInfo(prjSelectedItem);
                        if (data)
                        {
                            Maker(data, FALSE);
                            break;
                        }
                    }
            
                    Maker(workArea, FALSE);
                }
                break;
            case IDM_BUILDALL:
                Maker(workArea, TRUE);
                break;                
            case IDM_BUILDALL_RIGHTCLICK:
                if (prjSelectedItem)
                {
                    PROJECTITEM *data = GetItemInfo(prjSelectedItem);
                    if (data)
                    {
                        Maker(data, TRUE);
                        break;
                    }
                }
                Maker(workArea, TRUE);
                break;
            case IDM_BUILDSELECTED:
                Maker(activeProject, FALSE);
                break;
            case IDM_STOPBUILD:
                StopBuild();
                break;
            case IDM_CALCULATEDEPENDS:
                CalculateProjectDepends(GetItemInfo(prjSelectedItem));
                break;
            case IDM_RUNNODEBUG:
            {
                SaveWorkArea(workArea);
                RunProgram(activeProject);
                break;
            }
            case IDM_SELECTPROFILE:
                SelectProfileDialog();
                break;
            case IDM_ACTIVEPROJECTPROPERTIES:
                if (activeProject)
                    prjSelectedItem = activeProject->hTreeItem;
                // fall through
            case IDM_PROJECTPROPERTIES:
                data = GetItemInfo(prjSelectedItem);
                ShowBuildProperties(data);
                break;
            case IDM_PROJECTDEPENDS:
                data = GetItemInfo(prjSelectedItem);
                EditProjectDependencies(data);
                break;
            case IDM_OPENFILES:
                data = GetItemInfo(prjSelectedItem);
                if (data)
                    if (data->type == PJ_FILE)
                    {
                        if (strlen(data->realName) >= 3 && !stricmp(data->realName + strlen(data->realName) -3, ".rc"))
                        {
                            NavigateToResource(data);
                        }
                        else
                        {
                            strcpy(info.dwName, data->realName);
                            strcpy(info.dwTitle, data->displayName);
                            info.dwLineNo =  - 1;
                            info.logMRU = FALSE;
                            info.newFile = FALSE;
                            CreateDrawWindow(&info, TRUE);
                        }
                    }
                break;
            case IDM_CLOSE:
                SendMessage(hwnd, WM_CLOSE, 0, 0);
                break;
            default:
                return DefWindowProc(hwnd, iMessage, wParam, lParam);
            }
            break;
        case WM_LBUTTONUP:
            if (dragging)
            {
                SetCursor(origCurs);
                ReleaseCapture();
                dragging = FALSE;
                TreeView_SelectDropTarget(prjTreeWindow, NULL);
                if (inView && dstItem != srcItem && srcItem && dstItem)
                {
                    DragTo(dstItem, srcItem);
                }
            }
            break;
        case WM_MOUSEMOVE:
            if (dragging)
            {
                hittest.pt.x = (long)(short)LOWORD(lParam);
                hittest.pt.y = (long)(short)HIWORD(lParam);
                
                dstItem = TreeView_HitTest(prjTreeWindow, &hittest);
                if (dstItem && dstItem != srcItem)
                {
                    PROJECTITEM *srcData = GetItemInfo(srcItem);
                    data = GetItemInfo(dstItem);
                    if (srcData && data)
                    {
                        PROJECTITEM *p = data->parent;
                        while (p)
                            if (p == srcData)
                                break;
                            else
                                p = p->parent;
                        if (p)
                        {
                            if (inView)
                            {
                                inView = FALSE;
                                SetCursor(noCur);
                                TreeView_SelectDropTarget(prjTreeWindow, NULL);
                            }
                            break;
                        }
                    }
                    if (data && (data->type == PJ_PROJ || data->type == PJ_FOLDER))
                    {
                        if (!inView)
                        {
                            inView = TRUE;
                            SetCursor(dragCur);
                        }
                        TreeView_SelectDropTarget(prjTreeWindow, dstItem);
                    }
                    else
                    {
                        if (inView)
                        {
                            inView = FALSE;
                            SetCursor(noCur);
                            TreeView_SelectDropTarget(prjTreeWindow, NULL);
                        }
                    }
                }
                else
                {
                    if (inView)
                    {
                        inView = FALSE;
                        SetCursor(noCur);
                        TreeView_SelectDropTarget(prjTreeWindow, NULL);
                    }
                }
            }
            break;
        case WM_SETFOCUS:
            PostMessage(hwndFrame, WM_REDRAWTOOLBAR, 0, 0);
            SetFocus(prjTreeWindow);
            break;
        case WM_CREATE:
            hwndProject = hwnd;
            GetClientRect(hwnd, &rs);

            treeViewSelected = 0;
            dragCur = LoadCursor(hInstance, "ID_DRAGCUR");
            noCur = LoadCursor(hInstance, "ID_NODRAGCUR");
            folderClose = LoadBitmap(hInstance, "ID_FOLDERCLOSE");
            folderOpen = LoadBitmap(hInstance, "ID_FOLDEROPEN");
            treeIml = ImageList_Create(16, 16, ILC_COLOR24, IL_IMAGECOUNT+2, 0);
            
            mainIml = LoadBitmap(hInstance, "ID_FILES");
            ChangeBitmapColor(mainIml, 0xffffff, RetrieveSysColor(COLOR_WINDOW));
            ImageList_Add(treeIml, mainIml, NULL);
            ilfolderClose = ImageList_Add(treeIml, folderClose, 0);
            ilfolderOpen = ImageList_Add(treeIml, folderOpen, 0);
            DeleteObject(folderClose);
            DeleteObject(folderOpen);
            DeleteObject(mainIml);
            prjTreeWindow = CreateWindowEx(0, sztreeDoubleBufferName, "", WS_VISIBLE |
                WS_CHILD | TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS | TVS_TRACKSELECT,
                0, 0, rs.right, rs.bottom, hwnd, (HMENU)ID_TREEVIEW,
                hInstance, NULL);
            TreeView_SetImageList(prjTreeWindow, treeIml, TVSIL_NORMAL);
            lf = systemDialogFont;
            projFont = CreateFontIndirect(&lf);
            lf.lfItalic = TRUE;
            italicProjFont = CreateFontIndirect(&lf);
            lf.lfItalic = FALSE;
            lf.lfWeight = FW_BOLD;
            boldProjFont = CreateFontIndirect(&lf);
            SendMessage(prjTreeWindow, WM_SETFONT, (WPARAM)boldProjFont, 0);
            return 0;
        case WM_CLOSE:
            SaveAllProjects(workArea, FALSE);
            break;
        case WM_DESTROY:
            FreeSubTree(workArea, FALSE);
            DestroyWindow(prjTreeWindow);
            DeleteObject(projFont);
            DeleteObject(boldProjFont);
            DeleteObject(italicProjFont);
            DestroyCursor(dragCur);
            DestroyCursor(noCur);
            hwndProject = 0;
            break;
        case WM_SIZE:
            MoveWindow(prjTreeWindow, 0, 0, LOWORD(lParam), HIWORD(lParam), 0);
            break;
        default:
            break;
    }
    return DefWindowProc(hwnd, iMessage, wParam, lParam);
}
Beispiel #11
0
LRESULT CALLBACK ColumnTreeWndProc(HWND hwnd, UINT iMessage, WPARAM
    wParam, LPARAM lParam)
{
    HTREEITEM titem;
    HD_LAYOUT hdl;
    WINDOWPOS wp;
    COLUMNINFO *ptr;
    RECT r,  *rp;
    HD_ITEM hie;
    TCHeader *h;
    HD_NOTIFY *n;
    TV_DISPINFO *t;
    LPTV_INSERTSTRUCT is;
    int i;
    TV_ITEM item;
    TCData *td;
    TV_HITTESTINFO tvh;
    TREEINFO *treeinfo;
    PAINTSTRUCT ps;
    HDC dc;
    NM_TREEVIEW *ntv;
    if (iMessage >= TV_FIRST && iMessage < TV_FIRST + 100)
    {
        ptr = (COLUMNINFO*)GetWindowLong(hwnd, 0);
        switch (iMessage)
        {
            case TVM_HITTEST:
                tvh.pt = ((TV_HITTESTINFO*)lParam)->pt;
                ptr = (COLUMNINFO*)GetWindowLong(hwnd, 0);
                GetRelativeRect(hwnd, ptr->hwndTree, &r);
                tvh.pt.x -= r.left;
                tvh.pt.y -= r.top;
                if ((titem = TreeView_HitTest(ptr->hwndTree, &tvh)))
                {
                    ((TV_HITTESTINFO*)lParam)->flags = tvh.flags;
                    ((TV_HITTESTINFO*)lParam)->hItem = tvh.hItem;
                }
                return (LRESULT)titem;
            case TVM_INSERTITEM:
                is = (LPTV_INSERTSTRUCT)lParam;
                is->UNNAMED_UNION item.mask |= TVIF_TEXT | TVIF_PARAM;
                is->UNNAMED_UNION item.pszText = LPSTR_TEXTCALLBACK;
                titem = (HTREEITEM)SendMessage(ptr->hwndTree, iMessage, wParam,
                    lParam);
                return (LRESULT)titem;
            default:
                return SendMessage(ptr->hwndTree, iMessage, wParam, lParam);
        }
    }
    else if (iMessage >= HDM_FIRST && iMessage < HDM_FIRST + 100)
    {
        ptr = (COLUMNINFO*)GetWindowLong(hwnd, 0);
        return SendMessage(ptr->hwndHeader, iMessage, wParam, lParam);
    }
    switch (iMessage)
    {
        case WM_ERASEBKGND:
            return 1;
        case WM_NOTIFY:
            n = (HD_NOTIFY*)lParam;
            ptr = (COLUMNINFO*)GetWindowLong(hwnd, 0);
            switch (n->hdr.code)
            {
            case NM_RCLICK:
                #ifdef XXXXX
                    ptr = (COLUMNINFO*)GetWindowLong(hwnd, 0);
                    GetCursorPos(&pos);
                    ScreenToClient(ptr->hwndTree, &pos);
                    titem = TreeView_HitTest(ptr->hwndTree, &pos);
                    for (i = 0; i < ptr->displaycount; i++)
                    if (titem == ptr->displaylist[i])
                    {
                        ptr->sel = i;
                        InvalidateRect(ptr->hwndTree, 0, 0);
                        break;
                    }
                #endif 
                return SendMessage(GetParent(hwnd), iMessage, wParam, lParam);
            case TVN_SELCHANGING:
                return TRUE;
            case HDN_ENDTRACK:
                SendMessage(ptr->hwndTree, TCF_SETDIVIDER, 0, n->pitem->cxy);
                InvalidateRect(ptr->hwndTree, 0, 1);
                return 0;
            case TVN_GETDISPINFO:
                t = (LPNMTVDISPINFO)n;
                if (TreeView_GetItemRect(ptr->hwndTree, t->item.hItem, &r, TRUE)
                    )
                {
                    if (ptr->displaycount < DISPLAY_MAX)
                        ptr->displaylist[ptr->displaycount++] = t->item.hItem;
                    strcpy(t->item.pszText, "");
//                    t->item.cchTextMax = 0;
                }
                return 0;
            case TVN_DELETEITEM:
                ntv = (NM_TREEVIEW*)lParam;
                if (ptr->displaycount)
                    for (i = 0; i < ptr->displaycount; i++)
                if (ptr->displaylist[i] == ntv->itemOld.hItem)
                {
                    ptr->sel =  - 1;
                    memcpy(&ptr->displaylist[i], &ptr->displaylist[i + 1], (ptr
                        ->displaycount - i - 1) *sizeof(HTREEITEM));
                    ptr->displaycount--;
                    return 0;
                }
                return 0;
            }
            // fall through 
        case WM_COMMAND:
            return SendMessage(GetParent(hwnd), iMessage, wParam, lParam);
        case WM_CREATE:
            ptr = (COLUMNINFO*)calloc(1, sizeof(COLUMNINFO)
                );
            ptr->displaycount = 0;
            ptr->sel =  - 1;
            SetWindowLong(hwnd, 0, (int)ptr);
            GetClientRect(hwnd, &r);
            ptr->hwndHeader = CreateWindow(WC_HEADER, 0, WS_CLIPSIBLINGS |
                WS_CHILD | HDS_HORZ | WS_BORDER, r.left, r.top, r.right -
                r.left, r.bottom - r.top, hwnd, 0, (HINSTANCE)GetWindowLong
                (GetParent(hwnd), GWL_HINSTANCE), 0);
            hdl.prc = &r;
            hdl.pwpos = &wp;
            SendMessage(ptr->hwndHeader, HDM_LAYOUT, 0, (LPARAM) &hdl);
            //         wp.x += 2*GetSystemMetrics(SM_CXDLGFRAME );
            //         wp.cx -= 4 * GetSystemMetrics(SM_CXDLGFRAME) ;
            //         wp.y += 2*GetSystemMetrics(SM_CYDLGFRAME );
            //         wp.cy -= 4 * GetSystemMetrics(SM_CYDLGFRAME) ;
            ptr->watchFont = CreateFontIndirect(&systemDialogFont);
            SendMessage(ptr->hwndHeader, WM_SETFONT, (WPARAM)ptr->watchFont, 0);
            SetWindowPos(ptr->hwndHeader, wp.hwndInsertAfter, wp.x, wp.y, wp.cx,
                wp.cy, wp.flags | SWP_SHOWWINDOW);
            r.left = wp.x;
            r.right = wp.x + wp.cx;
            r.top = wp.y + wp.cy;
            ptr->hwndTree = CreateWindowEx(0, szextTreeWindClassName, 0,
                WS_CLIPSIBLINGS | WS_VISIBLE | WS_CHILD | WS_BORDER |
                TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS, r.left, r.top,
                r.right - r.left, r.bottom - r.top, hwnd, (HMENU)1000, 
                (HINSTANCE)GetWindowLong(GetParent(hwnd), GWL_HINSTANCE), 0);
            SendMessage(ptr->hwndTree, WM_SETFONT, (WPARAM)ptr->watchFont, 0);
            hie.mask = HDI_WIDTH;
            SendMessage(ptr->hwndHeader, HDM_GETITEM, 0, (LPARAM) &hie);
            SendMessage(ptr->hwndTree, TCF_SETDIVIDER, 0, hie.cxy);
            break;

        case WM_DESTROY:
            ptr = (COLUMNINFO*)GetWindowLong(hwnd, 0);
            DestroyWindow(ptr->hwndHeader);
            DeleteObject(ptr->watchFont);
            free((void*)ptr);
            break;
        case WM_LBUTTONDOWN:
        case WM_RBUTTONDOWN:
            break;
        case WM_SIZE:
            ptr = (COLUMNINFO*)GetWindowLong(hwnd, 0);
            r.left = r.top = 0;
            r.right = LOWORD(lParam);
            r.bottom = HIWORD(lParam);
            hdl.prc = &r;
            hdl.pwpos = &wp;
            SendMessage(ptr->hwndHeader, HDM_LAYOUT, 0, (LPARAM) &hdl);
            //         wp.x += 2*GetSystemMetrics(SM_CXDLGFRAME );
            //         wp.cx -= 4 * GetSystemMetrics(SM_CXDLGFRAME) ;
            //         wp.y += 2*GetSystemMetrics(SM_CYDLGFRAME );
            //         wp.cy -= 4 * GetSystemMetrics(SM_CYDLGFRAME) ;
            SetWindowPos(ptr->hwndHeader, wp.hwndInsertAfter, wp.x, wp.y, wp.cx,
                wp.cy, wp.flags);
            r.left = wp.x;
            r.right = wp.x + wp.cx;
            r.top = wp.y + wp.cy;
            MoveWindow(ptr->hwndTree, r.left, r.top, r.right - r.left, r.bottom
                - r.top, 0);
            GetClientRect(ptr->hwndHeader, &r);
            hie.mask = HDI_WIDTH;
            hie.cxy = (r.right - r.left) / 2;
            SendMessage(ptr->hwndHeader, HDM_SETITEM, 0, (LPARAM) &hie);
            SendMessage(ptr->hwndHeader, HDM_SETITEM, 1, (LPARAM) &hie);
            SendMessage(ptr->hwndTree, TCF_SETDIVIDER, 0, hie.cxy);
            InvalidateRect(ptr->hwndHeader, 0, 1);
            InvalidateRect(ptr->hwndTree, 0, 1);
            break;
        case TCF_SETHEADER:
            ptr = (COLUMNINFO*)GetWindowLong(hwnd, 0);
            h = (TCHeader*)lParam;
            GetWindowRect(ptr->hwndHeader, &r);
            hie.mask = HDI_TEXT | HDI_FORMAT | HDI_WIDTH;
            if (h->colBmp1)
                    hie.mask |= HDI_BITMAP;
            hie.pszText = h->colText1;
            hie.hbm = h->colBmp1;
            hie.cxy = (r.right - r.left) / 2;
            hie.cchTextMax = strlen(h->colText1);
            hie.fmt = HDF_LEFT | HDF_STRING;
            SendMessage(ptr->hwndHeader, HDM_INSERTITEM, 100, (LPARAM) &hie);
            hie.mask = HDI_TEXT | HDI_FORMAT | HDI_WIDTH;
            if (h->colBmp2)
                hie.mask |= HDI_BITMAP;
            hie.pszText = h->colText2;
            hie.hbm = h->colBmp2;
            hie.cxy = (r.right - r.left) / 2;
            hie.cchTextMax = strlen(h->colText2);
            hie.fmt = HDF_LEFT | HDF_STRING;
            SendMessage(ptr->hwndHeader, HDM_INSERTITEM, 100, (LPARAM) &hie);
            SendMessage(ptr->hwndTree, TCF_SETDIVIDER, 0, hie.cxy);
            return 0;
        case WM_PAINT:
            dc = BeginPaint(hwnd, &ps);
            EndPaint(hwnd, &ps);
            break;
        case WM_ACTIVATEME:
            SendMessage(GetParent(hwnd), WM_ACTIVATEME, 0, 0);
            break;
        case WM_SETFONT:
        case WM_GETFONT:
            ptr = (COLUMNINFO*)GetWindowLong(hwnd, 0);
            return SendMessage(ptr->hwndTree, iMessage, wParam, lParam);
        case TCN_PAINT:
            rp = (RECT*)lParam;
            ptr = (COLUMNINFO*)GetWindowLong(hwnd, 0);
            {
                hie.mask = HDI_WIDTH;
                SendMessage(ptr->hwndHeader, HDM_GETITEM, 0, (LPARAM) &hie);
                hie.cxy -= GetSystemMetrics(SM_CXBORDER);
                rp->left = hie.cxy;
                if (rp->left < rp->right)
                {
                    LOGBRUSH lbrush;
                    HBRUSH graybrush;
                    HDC dc = (HDC)wParam;
                    int lined = FALSE;
                    HFONT font = (HFONT)SendMessage(ptr->hwndTree, WM_GETFONT,
                        0, 0);
                    lbrush.lbStyle = BS_SOLID;
                    lbrush.lbColor = 0xff0000;
                    graybrush = CreateBrushIndirect(&lbrush);
//                    dc = GetDC(ptr->hwndTree);
                    font = SelectObject(dc, font);
                    if (GetWindowLong(hwnd, GWL_STYLE) &TCS_LINE)
                    {
                        HPEN pen;
                        pen = CreatePen(PS_SOLID, 1, 0);

                        lined = TRUE;
                        pen = SelectObject(dc, pen);
                        MoveToEx(dc, rp->left, rp->top, 0);
                        LineTo(dc, rp->left, rp->bottom + 1);
                        pen = SelectObject(dc, pen);
                        DeleteObject(pen);
                    }
                    for (i = 0; i < ptr->displaycount; i++)
                    {
                        COLORREF color, bgcolor;
                        item.hItem = ptr->displaylist[i];
                        item.mask = TVIF_PARAM;
                        TreeView_GetItem(ptr->hwndTree, &item);
                        td = (TCData*)item.lParam;
                        TreeView_GetItemRect(ptr->hwndTree, ptr->displaylist[i],
                            &r, TRUE);
                        if (td->col1Text)
                        {
                            HRGN rgn;
                            rgn = CreateRectRgn(r.left, r.top, rp->left - 2,
                                r.bottom);
                            SelectClipRgn(dc, rgn);
                            if (ptr->sel == i)
                            {
                                color = SetTextColor(dc, RetrieveSysColor(COLOR_WINDOW));
                                bgcolor = SetBkColor(dc, td->col1Color);
                            }
                            else
                                color = SetTextColor(dc, td->col1Color);
                            TextOut(dc, r.left, r.top, td->col1Text, strlen(td
                                ->col1Text));
                            SetTextColor(dc, color);
                            if (ptr->sel == i)
                                SetBkColor(dc, bgcolor);
                            SelectClipRgn(dc, NULL);
                            DeleteObject(rgn);
                        }
                        if (td->col2Text)
                        {
                            if (ptr->sel == i)
                            {
                                color = SetTextColor(dc, RetrieveSysColor(COLOR_WINDOW));
                                bgcolor = SetBkColor(dc, td->col2Color);
                            }
                            else
                                color = SetTextColor(dc, td->col2Color);
                            TextOut(dc, rp->left + (lined ? 3 : 0), r.top, td
                                ->col2Text, strlen(td->col2Text));
                            SetTextColor(dc, color);
                            if (ptr->sel == i)
                                SetBkColor(dc, bgcolor);
                        }
                    }
                    SelectObject(dc, font);
//                    ReleaseDC(ptr->hwndTree, dc);
                    DeleteObject(graybrush);

                }
                ptr->displaycount = 0;
            }
            break;
    }
    return DefWindowProc(hwnd, iMessage, wParam, lParam);
}
Beispiel #12
0
    LRESULT CALLBACK funcProc(HWND hwnd, UINT iMessage, WPARAM wParam, LPARAM
        lParam)
    {
        static EDITDATA *ptr;
        static CCFUNCDATA **funcs[100];
        static int funcpos[100];
        static int nesting[100];
        static int curarg[100];
        static int index;
        static HFONT normal, bold, oldfont;
        static POINT origin[100];
        static HBITMAP leftarrow, rightarrow;
        int offset;
        int oldbk, oldfg;
        LOGFONT lf;
        PAINTSTRUCT ps;
        HPEN pen;
        HBRUSH brush;
        HDC dc;
        SIZE size1, size2;
        RECT r;
        char * fragments[4];
        switch(iMessage)
        {
            case WM_CREATE:
                leftarrow = LoadBitmap(hInstance, "ID_CCLEFTARR");
                rightarrow = LoadBitmap(hInstance, "ID_CCRIGHTARR");
                lf = systemDialogFont;
                normal = (HFONT)CreateFontIndirect(&lf);
                lf.lfWeight = FW_BOLD;
                bold = CreateFontIndirect(&lf);
                SetLayeredWindowAttributes(hwnd, TRANSPARENT_COLOR, 0xff, LWA_COLORKEY);
                break;
            case WM_USER:
                funcs[index] = (CCFUNCDATA *)lParam;
                funcpos[index] = 0;
                nesting[index]  = 0;
                curarg[index] = 0;
                index++;
                if (IsWindowVisible(hwnd))
                    SetFuncWindowSize(hwnd, normal, bold, origin[index-1], funcs[index-1], funcpos[index-1], curarg[index-1]);
                    
                break;
            case WM_USER + 1:
            {
                POINTL pt;
                ptr = (EDITDATA *)lParam;
                posfromchar((HWND)wParam, ptr, &pt,ptr->selendcharpos);
                origin[index-1].x = pt.x;
                origin[index-1].y = pt.y;
                MapWindowPoints((HWND)wParam, hwndFrame, &origin[index-1], 1);
                origin[index-1].y += ptr->cd->txtFontHeight;
            }
                break;                
            case WM_USER + 2:
                curarg[index-1] = wParam;
                SetFuncWindowSize(hwnd, normal, bold, origin[index-1], funcs[index-1], funcpos[index-1], curarg[index-1]);
                break;

            case WM_SHOWWINDOW:
            {
                if (wParam)
                {
                    SetFuncWindowSize(hwnd, normal, bold, origin[index-1], funcs[index-1], funcpos[index-1], curarg[index-1]);
                }
                else
                {
                    ccFreeFunctionList(funcs[--index]);
                    if (index)
                        ShowWindow(hwnd, SW_SHOW);
                }
            }
            case WM_USER + 3:
                if (IsWindowVisible(hwnd))
                {
                    switch(wParam)
                    {
                        case VK_DOWN:
                            if (GetFuncCount(funcs[index-1]) > 1)
                            {
                                funcpos[index-1] ++;
                                if (funcpos[index-1] >= GetFuncCount(funcs[index-1]))
                                    funcpos[index-1] = 0;
                                SetFuncWindowSize(hwnd, normal, bold, origin[index-1], funcs[index-1], funcpos[index-1], curarg[index-1]);

                                return 0;
                            }
                        case VK_UP:
                            if (GetFuncCount(funcs[index-1]) > 1)
                            {
                                funcpos[index-1] --;
                                if (funcpos[index-1] < 0)
                                    funcpos[index-1] = GetFuncCount(funcs[index-1]);
                                SetFuncWindowSize(hwnd, normal, bold, origin[index-1], funcs[index-1], funcpos[index-1], curarg[index-1]);
                                return 0;
                            }
                        case VK_HOME:
                        case VK_END:
                        case VK_PRIOR:
                        case VK_NEXT:
                            if (index == 1)
                                ShowWindow(hwnd, SW_HIDE);
                            else
                            {
                                ccFreeFunctionList(funcs[--index]);
                                SetFuncWindowSize(hwnd, normal, bold, origin[index-1], funcs[index-1], funcpos[index-1], curarg[index-1]);
                            }
                            return 1;
                        case VK_BACK:
                            if (ptr->selendcharpos)
                                switch(ptr->cd->text[ptr->selendcharpos - 1].ch)
                                {
                                    case ',':
                                        --curarg[index-1];
                                        SetFuncWindowSize(hwnd, normal, bold, origin[index-1], funcs[index-1], funcpos[index-1], curarg[index-1]);
                                        return 1;
                                    case '(':
                                        if (--nesting[index-1] < 0)
                                        {
                                            if (index == 1)
                                                ShowWindow(hwnd, SW_HIDE);
                                            else
                                            {
                                                ccFreeFunctionList(funcs[--index]);
                                                SetFuncWindowSize(hwnd, normal, bold, origin[index-1], funcs[index-1], funcpos[index-1], curarg[index-1]);
                                            }
                                        }
                                        break;
                                    case ')':
                                        ++nesting[index-1];
                                        break;
                                }
                            return 1;
                            break;
                        default:
                        {
                            int key = KeyboardToAscii(wParam, lParam, TRUE);
                            switch(key)
                            {
                                case ',':
                                    ++curarg[index-1];
                                    SetFuncWindowSize(hwnd, normal, bold, origin[index-1], funcs[index-1], funcpos[index-1], curarg[index-1]);
                                    break;
                                case '(':
                                    ++nesting[index-1];
                                    break;
                                case ')':
                                    if (--nesting[index-1] < 0)
                                    {
                                        if (index == 1)
                                            ShowWindow(hwnd, SW_HIDE);
                                        else
                                        {
                                            ccFreeFunctionList(funcs[--index]);
                                            SetFuncWindowSize(hwnd, normal, bold, origin[index-1], funcs[index-1], funcpos[index-1], curarg[index-1]);
                                        }
                                    }
                                    break;
                            }
                            return 1;
                            break;
                        }
                    }
                }
                break;
            case WM_PAINT:
                dc = BeginPaint(hwnd, &ps);
                GetClientRect(hwnd, &r);
                brush = CreateSolidBrush(TRANSPARENT_COLOR);
                FillRect(dc, &r, brush);
                DeleteObject(brush);

                brush = CreateSolidBrush(RetrieveSysColor(COLOR_INFOBK));
                brush = SelectObject(dc, brush);
                pen = CreatePen(PS_SOLID, 0, 0);
                pen = SelectObject(dc, pen); 
                RoundRect(dc, r.left, r.top, r.right, r.bottom, 5, 5);
                brush = SelectObject(dc, brush);
                DeleteObject(brush);
                pen = SelectObject(dc, pen);
                DeleteObject(pen);
                
                if (GetFragments(funcs[index-1], funcpos[index-1], curarg[index-1], fragments))
                {
                    SIZE sz;
                    HDC *memDC = CreateCompatibleDC(dc);
                    int offset = 3 + GetSystemMetrics(SM_CXBORDER);
                    normal = SelectObject(dc, normal);
                    oldbk = SetBkColor(dc, RetrieveSysColor(COLOR_INFOBK));
                    oldfg = SetTextColor(dc, RetrieveSysColor(COLOR_INFOTEXT));
                    GetTextExtentPoint32(dc, fragments[0], strlen(fragments[0]), &sz);
                    TextOut(dc, offset+12, 2, fragments[0], strlen(fragments[0]));

                    leftarrow = SelectObject(memDC, leftarrow);
                    TransparentBlt(dc, offset+2, ((sz.cy+3)-10)/2, 10, 10, memDC, 0, 0, 10, 10, 0xc0c0c0);
                    offset += 12 + sz.cx;
                    leftarrow = SelectObject(memDC, leftarrow);
                    rightarrow = SelectObject(memDC, rightarrow);
                    TransparentBlt(dc, offset+2, ((sz.cy+3)-10)/2, 10, 10, memDC, 0, 0, 10, 10, 0xc0c0c0);
                    rightarrow = SelectObject(memDC, rightarrow);
                    offset += 12 + 4;
                    GetTextExtentPoint32(dc, fragments[1], strlen(fragments[1]), &sz);
                    TextOut(dc, offset, 2, fragments[1], strlen(fragments[1]));
                    offset += sz.cx;
                    if (fragments[2])
                    {
                        normal = SelectObject(dc, normal);
                        bold = SelectObject(dc, bold);
                        GetTextExtentPoint32(dc, fragments[2], strlen(fragments[2]), &sz);
                        TextOut(dc, offset, 2, fragments[2], strlen(fragments[2]));
                        offset += sz.cx;
                        bold = SelectObject(dc, bold);
                        normal = SelectObject(dc, normal);
                    }
                    GetTextExtentPoint32(dc, fragments[3], strlen(fragments[3]), &sz);
                    TextOut(dc, offset, 2, fragments[3], strlen(fragments[3]));
                    offset += sz.cx;
                    
                    DeleteDC(memDC);                    
                    normal = SelectObject(dc, normal);
                    oldbk = SetBkColor(dc, oldbk);
                    oldfg = SetTextColor(dc, oldfg);
                    FreeFragments(fragments);
                }
                EndPaint(hwnd, &ps);
                return 0;
        }
        return DefWindowProc(hwnd, iMessage, wParam, lParam);
    }