示例#1
0
void ShowHelpDialog(BOOL about)
{
    int a = about ? 1 : 0;
    if(HelpWindowOpen[a]) {
        SetForegroundWindow(HelpDialog[a]);
        return;
    }

    MakeClass();

    char *s = about ? "About LDmicro" : "LDmicro Help";
    HelpDialog[a] = CreateWindowEx(0, "LDmicroHelp", s,
        WS_OVERLAPPED | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX |
        WS_SIZEBOX,
        100, 100, 650, 300+10*FONT_HEIGHT, NULL, NULL, Instance, NULL);
    MakeControls(a);
   
    ShowWindow(HelpDialog[a], TRUE);
    SetFocus(RichEdit[a]);

    HelpWindowOpen[a] = TRUE;

    RECT r;
    GetClientRect(HelpDialog[a], &r);
    TitleHeight = 300 - r.bottom;

    GetWindowRect(HelpDialog[a], &r);
    Resizing(&r, WMSZ_TOP);
    SetWindowPos(HelpDialog[a], HWND_TOP, r.left, r.top, r.right - r.left, 
        r.bottom - r.top, 0);
}
示例#2
0
//-----------------------------------------------------------------------------
// Window proc for the help dialog.
//-----------------------------------------------------------------------------
static LRESULT CALLBACK HelpProc(HWND hwnd, UINT msg, WPARAM wParam,
    LPARAM lParam)
{
    int a = (hwnd == HelpDialog[0] ? 0 : 1);
    switch (msg) {
        case WM_SIZING: {
            RECT *r = (RECT *)lParam;
            return Resizing(r, wParam);
            break;
        }
        case WM_SIZE:
            SizeRichEdit(a);
            break;

        case WM_ACTIVATE:
        case WM_KEYDOWN:
            SetFocus(RichEdit[a]);
            break;
    
        case WM_DESTROY:
        case WM_CLOSE:
            HelpWindowOpen[a] = FALSE;
            // fall through
        default:
            return DefWindowProc(hwnd, msg, wParam, lParam);
    }

    return 1;
}
示例#3
0
文件: geom.c 项目: ArcScofield/Amaya
/*----------------------------------------------------------------------
  GeometryResize draws a box at a specific origin location (x,y) in
  frame and of initial size (width, height) when interracting with
  the user to mofify the box geometry (button press).
  xmin, xmax, ymin, ymax are the maximum values allowed.
  xm and ym gives the initial mouse coordinates in the frame.
  Parameters percentW and percentH will be equal to zero if width
  and height are independent or will get the percent report (percentH = 100
  if height is equal to width).
  This function returns the new dimensions of the box.
  ----------------------------------------------------------------------*/
void GeometryResize (int frame, int x, int y, int *width, int *height,
                     PtrBox box, int xmin, int xmax, int ymin, int ymax,
                     int xm, int ym, int percentW, int percentH)
{
  Resizing (frame, x, y, width, height, box, xmin, xmax, ymin, ymax, xm, ym,
            percentW, percentH);
}
示例#4
0
文件: geom.c 项目: ArcScofield/Amaya
/*----------------------------------------------------------------------
  GeometryCreate draws a box at a specific origin location (x, y) in
  frame and of the initial size (width, height) when interracting with
  the user to mofify a box size (button press).
  xmin, xmax, ymin, ymax are the maximum values allowed.
  PosX, PosY, DimX, DimY will be different to zero if these positions or
  dimensions are user specified.
  Parameters percentW and percentH will be equal to zero if width
  and height are independent or will get the percent report (percentH = 100
  if height is equal to width).
  This function returns new values:
  - x, y the position of the origin.
  - width, height the dimension of the box.
  ----------------------------------------------------------------------*/
void GeometryCreate (int frame, int *x, int *y, int *width, int *height,
                     int xmin, int xmax, int ymin, int ymax, PtrBox box,
                     int PosX, int PosY, int DimX, int DimY, int percentW,
                     int percentH)
{
  ThotWindow          w;
  PtrAbstractBox      pAb;
  int                 xm, ym;
  int                 dx, dy;
  int                 ret;
  int                 xref, yref;
  ThotBool            isEllipse;

  pAb = box->BxAbstractBox;
  if (pAb && pAb->AbLeafType == LtCompound)
    pAb = pAb->AbFirstEnclosed;
  isEllipse = (pAb &&
               pAb->AbLeafType == LtGraphics &&
               (pAb->AbShape == 'a' || pAb->AbShape == 'c'));
  /* use relative coordinates */
  xm = ym = 0;
  /* default position */
  if (*x < xmin)
    *x = xmin;
  else if (*x > xmax)
    *x = xmax;
  if (*y < ymin)
    *y = ymin;
  else if (*y > ymax)
    *y = ymin;
  /* the grid origin is base on the englobing box origin */
  dx = DO_ALIGN (*x - xmin);
  *x = xmin + dx;
  dy = DO_ALIGN (*y - ymin);
  *y = ymin + dy;

  *width = 1;
  *height = 1;
  /* draw the current box geometry */
  switch (box->BxHorizEdge)
    {
    case Right:
      xref = *width;
      break;
    case VertMiddle:
      xref = *width / 2;
      break;
    case VertRef:
      xref = box->BxVertRef;
      *width = xref;
      break;
    default:
      xref = 0;
      break;
    }
  switch (box->BxVertEdge)
    {
    case Bottom:
      yref = *height;
      break;
    case HorizMiddle:
      yref = *height / 2;
      break;
    case HorizRef:
      yref = box->BxHorizRef;
      *height = yref;
      break;
    default:
      yref = 0;
      break;
    }
  /* change the cursor, modify library state */
  w = (ThotWindow)FrameTable[frame].WdFrame;

  if (isEllipse)
    InvertEllipse (frame, *x, *y, *width, *height, *x + xref, *y + yref);
  else
    BoxGeometry (frame, *x, *y, *width, *height, *x + xref, *y + yref);
  /* Loop on user input to keep the first point */
  ret = 0;

  /* switch off the old box geometry */
  if (isEllipse)
    InvertEllipse (frame, *x, *y, *width, *height, *x + xref, *y + yref);
  else
    BoxGeometry (frame, *x, *y, *width, *height, *x + xref, *y + yref);

  Resizing (frame, *x, *y, width, height, box, xmin, xmax, ymin, ymax, xm, ym, percentW, percentH);
}