Disable drag rectangle in cmViewOnly in 2.61

Please post bug reports, feature requests, or any question regarding the DELPHI AREA products here.

Disable drag rectangle in cmViewOnly in 2.61

Postby HPW » April 11th, 2006, 6:20 am

I changed this line:
Code: Select all
    else if (Button = mbLeft) and not (ssDouble in Shift) and (CommandMode <> cmViewOnly) then   {HPW added commandmode check}


in:
Code: Select all
procedure TSimpleGraph.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
  Pt: TPoint;
  NewObject: TGraphObject;
begin
  if not Focused then SetFocus;
  inherited MouseDown(Button, Shift, X, Y);
  Pt := ClientToGraph(X, Y);
  CheckObjectAtCursor(Pt);
  case CommandMode of
    cmInsertNode, cmInsertLink:
      if Assigned(DragSource) then
        DragSource.MouseDown(Button, Shift, Pt)
      else if (Button = mbLeft) and not (ssDouble in Shift) then
      begin
        NewObject := nil;
        case CommandMode of
          cmInsertNode:
            NewObject := InsertObjectByMouse(Pt, DefaultNodeClass, SnapToGrid xor (ssCtrl in Shift));
          cmInsertLink:
            NewObject := InsertObjectByMouse(Pt, DefaultLinkClass, SnapToGrid xor (ssCtrl in Shift));
        end;
        if Assigned(NewObject) then
        begin
          NewObject.Selected := True;
          NewObject.MouseDown(Button, Shift, Pt);
          if DragSource <> NewObject then
          begin
            CommandMode := cmEdit;
            ObjectChanged(NewObject, [gcData]);
          end
          else
            CursorPos := Pt;
          RenewObjectAtCursor(NewObject);
        end;
      end;
    cmPan:
      if (Button = mbLeft) and not (ssDouble in SHift) then
      begin
        fDragSourcePt.X := X;
        fDragSourcePt.Y := Y;
        Screen.Cursor := crHandGrab
      end;
  else
    if Assigned(ObjectAtCursor) and (CommandMode <> cmViewOnly) and
      (goSelectable in ObjectAtCursor.Options)
    then
      ObjectAtCursor.MouseDown(Button, Shift, Pt)
    else if (Button = mbLeft) and not (ssDouble in Shift) and (CommandMode <> cmViewOnly) then   {HPW commandmode abfragen}
    begin
      fDragSourcePt := Pt;
      fDragTargetPt := Pt;
      MarkedArea := MakeRect(fDragSourcePt, fDragTargetPt);
      Screen.Cursor := crCross;
    end;
  end;
end;


to get rid of the drag-rectangle in cmViewOnly.
Hans-Peter
HPW
Moderator
Moderator
 
Posts: 230
Joined: February 25th, 2006, 10:19 am
Location: Germany

Postby Kambiz » April 11th, 2006, 10:49 am

In this case, user cannot zoom a rectangular area on the graph (ALT + DRAG).
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2405
Joined: March 7th, 2003, 7:10 pm

Postby HPW » April 11th, 2006, 11:32 am

Had not think of that option.
Room for improvment! :wink:
Hans-Peter
HPW
Moderator
Moderator
 
Posts: 230
Joined: February 25th, 2006, 10:19 am
Location: Germany

Postby HPW » April 11th, 2006, 5:38 pm

That should do it both:

Code: Select all
    else if  ((Button = mbLeft)
             and not (ssDouble in Shift)
             and     (CommandMode <> cmViewOnly))
             or
             ((Button = mbLeft)
             and not (ssDouble in Shift)
             and     (ssAlt in Shift)
             and     (CommandMode = cmViewOnly))
    then   {HPW commandmode check}
Hans-Peter
HPW
Moderator
Moderator
 
Posts: 230
Joined: February 25th, 2006, 10:19 am
Location: Germany

Postby Kambiz » April 11th, 2006, 6:32 pm

Yes, it does. But we should let the user be free to press the ALT key before or after selecting the area.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2405
Joined: March 7th, 2003, 7:10 pm

Postby kokkoras » April 11th, 2006, 6:50 pm

What's wrong with selecting objects while in cmViewOnly mode?
Fotis
User avatar
kokkoras
Moderator
Moderator
 
Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece

Postby HPW » April 11th, 2006, 7:20 pm

>But we should let the user be free to press the ALT key before or after selecting the area.

Was not meant to get a general change in the component.
I will only do so in the plugin.

>What's wrong with selecting objects while in cmViewOnly mode?

In a ViewOnly modus there should be nothing selectable.
Selecting let the user think he could edit something.
Since I also provide special mouse actions for plugin users,
the drag-rectangle would disturb that use.
Hans-Peter
HPW
Moderator
Moderator
 
Posts: 230
Joined: February 25th, 2006, 10:19 am
Location: Germany


Return to DELPHI AREA Products

Who is online

Users browsing this forum: Google [Bot] and 2 guests

cron