Exemplo n.º 1
0
void set_window_modes(void)
{
    HWND hwnd = my.hwnd;

    /* do we want to use the slit and is there a slit at all?  */
    if (my.useSlit && g_hSlit)
    {
        /* if in slit, dont move... */
        SetWindowPos(hwnd, NULL,
            0, 0, my.width, my.height,
            SWP_NOACTIVATE|SWP_NOSENDCHANGING|SWP_NOZORDER|SWP_NOMOVE
            );

        if (my.is_inslit)
        {
            /* we are already in the slit, so send update */
            SendMessage(g_hSlit, SLIT_UPDATE, 0, (LPARAM)hwnd);
        }
        else
        {
            /* transpareny must be off in slit */
            SetTransparency(hwnd, 255);
            /* enter slit now */
            my.is_inslit = true;
            SendMessage(g_hSlit, SLIT_ADD, 0, (LPARAM)hwnd);
        }
    }
    else
    {
        HWND hwnd_after = NULL;
        UINT flags = SWP_NOACTIVATE|SWP_NOSENDCHANGING|SWP_NOZORDER;
        RECT screen_rect;

        if (my.is_inslit)
        {
            /* leave it */
            SendMessage(g_hSlit, SLIT_REMOVE, 0, (LPARAM)hwnd);
            my.is_inslit = false;
        }

        if (my.is_ontop != my.alwaysOnTop)
        {
            my.is_ontop = my.alwaysOnTop;
            hwnd_after = my.is_ontop ? HWND_TOPMOST : HWND_NOTOPMOST;
            flags = SWP_NOACTIVATE|SWP_NOSENDCHANGING;
        }

        // make shure the plugin is on the screen:
        GetWindowRect(GetDesktopWindow(), &screen_rect);
        my.xpos = iminmax(my.xpos, screen_rect.left, screen_rect.right - my.width);
        my.ypos = iminmax(my.ypos, screen_rect.top, screen_rect.bottom - my.height);

        SetWindowPos(hwnd, hwnd_after, my.xpos, my.ypos, my.width, my.height, flags);
        SetTransparency(hwnd, (BYTE)(my.alphaEnabled ? my.alphaValue : 255));
    }

    /* window needs drawing */
    invalidate_window();
}
Exemplo n.º 2
0
//===========================================================================
// Function: EditBox
// Purpose: Display a single line editcontrol
// In:
// Out:
//===========================================================================
BOOL CALLBACK dlgproc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	static char *buffer;
	switch ( msg )
	{
	case WM_INITDIALOG:
		SetWindowText (hDlg, ((char**)lParam)[0]);
		SetDlgItemText(hDlg, 401, ((char**)lParam)[1]);
		SetDlgItemText(hDlg, 402, ((char**)lParam)[2]);
		buffer = ((char**)lParam)[3];
		MakeSticky(hDlg);
		{
			POINT p;
			GetCursorPos(&p);
			RECT m;
			GetMonitorRect(&p, &m, GETMON_WORKAREA|GETMON_FROM_POINT);
			RECT r;
			GetWindowRect(hDlg, &r);
#if 0
			// at cursor
			r.right -= r.left;
			r.bottom -= r.top;
			p.x = iminmax(p.x - r.right / 2,  m.left, m.right - r.right);
			p.y = iminmax(p.y - 10,  m.top, m.bottom - r.bottom);
#else
			// center screen
			p.x = (m.left + m.right - r.right + r.left) / 2;
			p.y = (m.top + m.bottom - r.bottom + r.top) / 2;
#endif
			SetWindowPos(hDlg, NULL, p.x, p.y, 0, 0, SWP_NOSIZE|SWP_NOZORDER);
		}
		return 1;

	case WM_MOUSEMOVE:
	case WM_NCMOUSEMOVE:
		SetForegroundWindow(hDlg);
		break;

	case WM_COMMAND:
		switch ( LOWORD( wParam ))
		{
		case IDOK:
			GetDlgItemText (hDlg, 402, buffer, 256);
		case IDCANCEL:
			RemoveSticky(hDlg);
			EndDialog(hDlg, LOWORD(wParam));
			return 1;
		}

	default:
		break;
	}
	return 0;
}
Exemplo n.º 3
0
int getmoupos(int mox, int moy) {
        int m,o,x,y;

        getmouxy(mox,moy,&x,&y);

        m=tlin-plin-(winflg&1);
        y=iminmax(y,0,m);

        curx = x+clft;
        cury = y;
        o=0;

        if (mox<zx0)    o=KEY_LEFT ;
        else
        if (mox>cwx)  o=KEY_RIGHT ;

        if (moy<zy0)    o=KEY_UP ;
        else
        if (moy>cwy && m>=pgy)  o=KEY_DOWN ;

#ifdef MV_DandD
        {
            int i=imax(-mox,imax(mox-cwx,imax(-moy,moy-cwy)));
            if (i>20) o=-1;
        }
#endif
        return o;
}
Exemplo n.º 4
0
//=============================================================================
void slit_info::getRCSettings()
{
    this->place = POS_CenterRight; /* default placement */
    BBP_read_window_modes(this, szAppName);

    this->baseWidth = BBP_read_int(this, "baseWidth", 0);
    this->order = BBP_read_int(this, "order", 2);
    this->setMargin = BBP_read_bool(this, "setMargin", false);
    this->alignment = iminmax (BBP_read_int(this, "alignment", 2), 1, 3);
}
Exemplo n.º 5
0
void hscroll(DWORD wP) {
    int n,k,d;
    if (edp==NULL) return;
    switch (LOWORD(wP)) {
    case SB_LINELEFT:  n=-1; goto h1;
    case SB_LINERIGHT: n=1;  goto h1;
    case SB_PAGELEFT:  n=-8; goto h1;
    case SB_PAGERIGHT: n=8;  goto h1;
    case SB_THUMBPOSITION:
    case SB_THUMBTRACK:
        if (0 == (d=SB_DIV-sbx)) return;
        k=HIWORD(wP); n=((lmax-pgx)*k+d-1)/d-clft;
    h1:
        clft=imax(0,clft+n);
        curx=iminmax(curx,clft,pgx+clft);
        upd=1;
        ed_cmd(EK_SETVAR);
    }
}
Exemplo n.º 6
0
void IntegerItem::set_next_value(void)
{
    int value, dir, mod, c, d;
    value = m_value;

    dir = m_direction;
    if (GetAsyncKeyState(VK_CONTROL) & 0x8000)
        dir *= 10;
    for (c = 15, d = 2; c < m_count; d = d==2?5:2, c += 10 + 4*d)
        dir *= d;

    mod = value % dir;
    if (mod > 0 && dir < 0) 
        mod+=dir;
    value -= mod;

    m_value = iminmax(value + dir, m_min, m_max);
    m_pMenu->Redraw(0);
    ++m_count;
}
Exemplo n.º 7
0
void vscroll(DWORD wP) {
    int n,k,v,d,p;
    if (edp==NULL) return;
    p=4; v=0; if (winflg&1) v=pgy+1;
    switch (LOWORD(wP)) {
    case SB_LINEUP:      n=-1; goto s1;
    case SB_LINEDOWN:    n=1;  goto s1;
    case SB_PAGEUP:      n=-p; goto s1;
    case SB_PAGEDOWN:    n=p;  goto s1;
    case SB_THUMBPOSITION:
    case SB_THUMBTRACK:
        if (0==(d=SB_DIV-sby)) return;
        k=HIWORD(wP); n=((tlin-v)*k+d-1)/d-plin;
    s1:
        n=imin(n,tlin-plin-v);
        movpage(n);
        cury=iminmax(cury-n,0,pgy);
        ed_cmd(EK_SETVAR);
    }
}
Exemplo n.º 8
0
unsigned int eightScale_up(unsigned int i)
{
	return i < 9 ? (i * 32 - 1) : iminmax(i, 0, 255);
}
Exemplo n.º 9
0
unsigned int eightScale_down(unsigned int i)
{
	return i > 8 ? (i / 32 + 1) : iminmax(i, 0, 255);
}
Exemplo n.º 10
0
void set_place(plugin_info *PI)
{
    int sw, sh, x, y, w, h, place;

    sw  = PI->mon_rect.right  - PI->mon_rect.left;
    sh  = PI->mon_rect.bottom - PI->mon_rect.top;
    x   = PI->xpos - PI->mon_rect.left;
    y   = PI->ypos - PI->mon_rect.top;
    w   = PI->width;
    h   = PI->height;
    place = PI->place;

    switch (place)
    {

        case POS_Top:
        case POS_TopLeft:
        case POS_TopCenter:
        case POS_TopRight:
            y = 0;
            break;

        case POS_CenterLeft:
        case POS_CenterRight:
        case POS_CenterV:
        case POS_Center:
            y = sh/2 - h/2;
            break;

        case POS_Bottom:
        case POS_BottomLeft:
        case POS_BottomCenter:
        case POS_BottomRight:
            y = sh - h;
            break;
    }

    switch (place)
    {
        case POS_Left:
        case POS_TopLeft:
        case POS_CenterLeft:
        case POS_BottomLeft:
            x = 0;
            break;

        case POS_TopCenter:
        case POS_BottomCenter:
        case POS_CenterH:
        case POS_Center:
        x = sw/2 - w/2;
            break;

        case POS_Right:
        case POS_TopRight:
        case POS_CenterRight:
        case POS_BottomRight:
            x = sw - w;
            break;
    }

    PI->xpos = PI->mon_rect.left + iminmax(x, 0, sw - w);
    PI->ypos = PI->mon_rect.top  + iminmax(y, 0, sh - h);
}
Exemplo n.º 11
0
int get_place(plugin_info *PI)
{
    int sw, sh, x, y, w, h;
    bool top, vcenter, bottom, left, center, right;

	// multimon - current monitor
    PI->hMon = GetMonitorRect(PI->hwnd, &PI->mon_rect, GETMON_FROM_WINDOW);

    sw  = PI->mon_rect.right  - PI->mon_rect.left;
    sh  = PI->mon_rect.bottom - PI->mon_rect.top;
    x   = PI->xpos - PI->mon_rect.left;
    y   = PI->ypos - PI->mon_rect.top;
    w   = PI->width;
    h   = PI->height;

    x = iminmax(x, 0, sw - w);
    y = iminmax(y, 0, sh - h);

    top        = y == 0;
    vcenter    = y == sh/2 - h/2;
    bottom     = y == (sh - h);

    left       = x == 0;
    center     = x == sw/2 - w/2;
    right      = x == (sw - w);

    if (top)
    {
        if (left)   return POS_TopLeft   ;
        if (center) return POS_TopCenter ;
        if (right)  return POS_TopRight  ;
        return POS_Top;
    }

    if (bottom)
    {
        if (left)   return POS_BottomLeft   ;
        if (center) return POS_BottomCenter ;
        if (right)  return POS_BottomRight  ;
        return POS_Bottom;
    }

    if (left)
    {
        if (vcenter) return POS_CenterLeft;
        return POS_Left;
    }

    if (right)
    {
        if (vcenter) return POS_CenterRight;
        return POS_Right;
    }

    if (center)
    {
        if (vcenter) return POS_Center;
        return POS_CenterH;
    }

    if (vcenter)
        return POS_CenterV;
    return POS_User;
}
Exemplo n.º 12
0
/*----------------------------------------------------------------------------*/
void getmouxy(int mox, int moy, int* x, int* y) {

        *x = iminmax((mox - zx0 + zx/3)/zx, 0, pgx);
        *y = iminmax((moy - zy0 - zy/2)/zy, 0, pgy);
}
Exemplo n.º 13
0
static int trans_late(int i, int d)
{
    if (d == -DELTA_INTERLACE || d >= DELTA_BEVEL) d *= 2;
    int r = i*(100+d)/100;
    return iminmax(r, 0, 255);
}