Ejemplo n.º 1
0
bool IrisWind::SetActiveScaling (long lZoom)
{
ObjContainer OC (0, 0, 0, 0);
ObjContainer oldOC = DBO().GetExtend();		// alten Ausschnitt merken
bool fResult = false;
Rectangle rcC (0, 0, 0, 0);

	for (int i = 0; i < 2; i++) {
		rcC = CanvasRect();

	Rectangle rc;
	
		if (NULL != m_pDRO) {
			rc = ((DragRectangleObject *)m_pDRO) -> GetRect();

		// Koordinaten kippen
		CoOrd tmpC = CoOrd(rc.Bottom() - rc.Top());
		
			rc.Bottom() = CoOrd(rc.Top() - tmpC);
		} else
			rc = rcC;
				
		fResult = DBO().SetActiveScaling (lZoom, rc, rcC, OC);
		if (!fResult) break;
	
	// neuen Ausschnitt einstellen
		SetExtend (OC, lZoom);

	// bei Bedarf ScrollBars einblenden und initialisieren
		if (!InitWndScrollBars())
			break;		// einmal reicht, wenn Scrollbars nicht geändert wurden
	}

// wenn Erfolgreich, dann alles neu einstellen
	if (fResult) {
		DELETE_OBJ (m_pDRO);

	// Übersichtsfenster bedienen
		if (OverViewCFlag && pOverView) 
			pOverView -> SetActVP (CanvasRect());
		actClip.Push (oldOC);

	// neu zeichnen
		LegendToRepaint = true;
		m_fRePaintFlag = true;
		RePaint();
	}

return fResult;
}
Ejemplo n.º 2
0
/****MainWndProc()***********************************************************/
LRESULT CALLBACK MainWndProc(HWND hWnd, UINT message,
							 WPARAM wParam, LPARAM lParam)
{
	HDC hDC;
    PAINTSTRUCT ps;
	int iadjust;
	long linecount, currentline, totallines;
	LPSTR textbuf;


    switch (message) 
    {
	case WM_CREATE:
		currentline = GetWindowLong(hWnd,TEXTLINECURRENT);
		totallines = GetWindowLong(hWnd,TEXTLINESTOTAL);
		textbuf = (LPSTR)GetWindowLong(hWnd,TEXTHANDLE);
    case WM_PAINT:
		hDC = BeginPaint(PrekinWindow,&ps);
		RePaint(hWnd, hDC);
		EndPaint(PrekinWindow,&ps);
		return(0);
    case WM_COMMAND:
      /* message: command from application menu? */
      switch (LOWORD(wParam)) 
      {                               /*processing routines in PKPCMENU.C */
        case PKIN_FILEOPENFILE:
			PKIN_FileOpenFile();
			break;
        case PKIN_FILENEWPASS:
			PKIN_FileNewPass();
			break;
		case PKIN_LAUNCHCURRENT:
			launchcurrentkinemage();
			break;
        case PKIN_FILEQUIT:
			PKIN_FileQuit();
			break;


        case PKIN_OPTIONSABOUTOPTIONS:
			PKIN_OptionsAboutOptions();
			break;
        case PKIN_OPTIONSMUTATIONS:
			PKIN_OptionsMutations();
			break;
        case PKIN_OPTIONSHELPHTML:
			writehelptohtmlfile(0); /*PKININIT.c*/
			break;

        default: return(DefWindowProc(hWnd, message, wParam, lParam));
      }
      return(0);
    case WM_SIZE:
        /* calculate new line start array and resetscrollbars done in completetext*/
		if (wParam != SIZE_MINIMIZED) completetext();
		return (DefWindowProc(hWnd,message,wParam,lParam));

	case WM_VSCROLL:
		linecount = linesonascreen(hWnd);
		/* messages from the scroll bar */
		currentline = GetWindowLong(hWnd, TEXTLINECURRENT);
		iadjust = 1;
		switch (LOWORD(wParam))

		{
			case SB_LINEDOWN:
				if (currentline == (GetWindowLong(hWnd,TEXTLINESTOTAL) - linecount))
					iadjust = 0; /* already at bottom, don't redraw */
				else ++currentline;
				break;
			case SB_LINEUP:
				if (currentline == 0) iadjust = 0;

				    /* already at top, don't redraw */
				else --currentline;
				break;
			case SB_PAGEDOWN:
				if (currentline == (GetWindowLong(hWnd,TEXTLINESTOTAL) - linecount))
					iadjust = 0; /* already at bottom, don't redraw */
				else currentline += linecount-1;
				break;
			case SB_PAGEUP:
				if (currentline == 0) iadjust = 0;
				    /* already at top, don't redraw */
				else currentline -= linecount+1;
				break;
			case SB_THUMBTRACK:
				if (currentline != HIWORD(wParam)) currentline = HIWORD(wParam);
				else iadjust = 0;
				break;
			default:
				iadjust = 0;
				return (DefWindowProc(hWnd,message,wParam,lParam));
		}
		if(iadjust)
		{
			if (currentline < 0) currentline = 0;
			if (currentline > (GetWindowLong(hWnd,TEXTLINESTOTAL)-linecount))
				currentline = (GetWindowLong(hWnd,TEXTLINESTOTAL)-linecount);
			SetWindowLong(hWnd,TEXTLINECURRENT,currentline);
			resetscrollbarvalues(hWnd);
			InvalidateRect(hWnd,NULL,TRUE);
		}
		return(0);
	case WM_MOUSEWHEEL:
		linecount = linesonascreen(hWnd);
		if (linecount <= GetWindowLong(hWnd,TEXTLINESTOTAL)-1)
		{/*don't do any of this if screen not full of text*/
			currentline = GetWindowLong(hWnd,TEXTLINECURRENT);
			iadjust = 1; /* by default redraw the screen */
			if(((short)HIWORD(wParam) > 0) && (currentline > 0)) currentline--;
			else if(((short)HIWORD(wParam) < 0) && 
				(currentline < (GetWindowLong(hWnd,TEXTLINESTOTAL)-linecount)))
				currentline++;
			else if (currentline < 0) currentline = 0;
			else if (currentline > (GetWindowLong(hWnd,TEXTLINESTOTAL)-linecount))
				currentline = (GetWindowLong(hWnd,TEXTLINESTOTAL)-linecount);
			else iadjust = 0; /* at top or bottom of text, don't redraw */
			if (iadjust)
			{
				SetWindowLong(hWnd,TEXTLINECURRENT,currentline);
				resetscrollbarvalues(hWnd);
				InvalidateRect(hWnd,NULL,TRUE);
			}
		}
		return(0);
	case WM_KEYDOWN:
        linecount = linesonascreen(hWnd);
		if (linecount <= GetWindowLong(hWnd,TEXTLINESTOTAL)-1)
		{/*don't do any of this if screen not full of text*/
			currentline = GetWindowLong(hWnd,TEXTLINECURRENT);
			iadjust = 1;
			switch (wParam)
			{
				case VK_HOME:
					if (currentline == 0) iadjust = 0;
					    /* already at top, don't redraw */
					else currentline = 0;
					break;
				case VK_END:
					if (currentline == (GetWindowLong(hWnd,TEXTLINESTOTAL) - linecount))
						iadjust = 0; /* already at bottom, don't redraw */
					else currentline = GetWindowLong(hWnd,TEXTLINESTOTAL) - linecount;
					break;
				case VK_PRIOR:
					if (currentline == 0)iadjust = 0;
					    /* already at top, don't redraw */
				    else currentline -= linecount+1;
					break;
				case VK_NEXT:
				    if (currentline == (GetWindowLong(hWnd,TEXTLINESTOTAL) - linecount))
						iadjust = 0; /* already at bottom, don't redraw */
				    else currentline += linecount-1;
				    break;
				case VK_UP:
				    if (currentline == 0)iadjust = 0;
					    /* already at top, don't redraw */
				    else --currentline;
				    break;
				case VK_DOWN:
				    if (currentline == (GetWindowLong(hWnd,TEXTLINESTOTAL) - linecount))
						iadjust = 0; /* already at bottom, don't redraw */
				    else ++currentline;
				    break;

				default:
					iadjust = 0;
				    return(DefWindowProc(hWnd, message, wParam, lParam));
			}
			if (iadjust==1)
			{
				if (currentline < 0) currentline = 0;
				if (currentline > (GetWindowLong(hWnd,TEXTLINESTOTAL)-linecount))
					currentline = (GetWindowLong(hWnd,TEXTLINESTOTAL)-linecount);
				SetWindowLong(hWnd,TEXTLINECURRENT,currentline);
				resetscrollbarvalues(hWnd);
				InvalidateRect(hWnd,NULL,TRUE);
			}
		}
		return(0);
	case WM_DESTROY:
        if (GetWindowLong(hWnd,TEXTHANDLE))
			free((HANDLE)GetWindowLong(hWnd,TEXTHANDLE));
        if (GetWindowLong(hWnd,TEXTLINESTARTHANDLE))
			free((HANDLE)GetWindowLong(hWnd,TEXTLINESTARTHANDLE));
		PostQuitMessage(0);
		return(0);
    default:                          /* Passes it on if unproccessed    */
        return (DefWindowProc(hWnd, message, wParam, lParam));
    }
}