DIY Layout Creator - software for easy drawing PCB, vero and perfboard layouts

Started by bancika, May 01, 2006, 08:00:21 PM

Previous topic - Next topic

beer

Yes , right clicking works every where but on the layout area in DIY-LC.
even if i want to rename an item in DIY-LC it works (Click two times on an item , right click -> paste) no problems.
But i some times get an "Access violation" i DIY-LC when rightclicking.

I've been messing around delphi for a couple of years , just for the fun of it , and would like to see how you've done it ,
if you don't mind sharing the sourcecodes.

bancika

the onboard component detection works pretty simple and not too optimized: I have visible bitmap (board that's displayed) and invisible 32bit bitmap in memory, each component has assigned color. On that invisible bitmap component outline is drawn with it's respective color. When user right clicks on visible board I check which color is on the same spot on invisible bitmap. Then I find component that's assigned to that color and open popup menu for that component. Simple and it should always work  :icon_rolleyes:
The new version of DIY Layout Creator is out, check it out here


beer

I don't think the problem is in the detection of the component.
it seems more as if the handler for the mouseclick is not activated.
i think i've tried this once with the "onmouseclick" trying to tricker a "popup".
as i remember i had to change it to the "onmouseup" and do a "if button = MBRight" or something like that.

bancika

I don't think it's a problem. See, I use color as handles (pointers) because they are basically the same format  (32bit number) as pointer is. So I use something like TComponent(Pointer(Bitmap.Pixels[x,y])) to access component that's under that mouse position, if any. So my guess is that somehow that hidden bitmap is screwed up (or reduced number of colors) so some handles become invalid
The new version of DIY Layout Creator is out, check it out here


beer

Ok , well maybe youre right.
its just odd , colors should be the same world wide ...
could you post the detection function/procedure ,
then i could give it a go on my computer , atleast i could trace it through the process ,
if youre interestet.

it's kind of annoying , not being able to use the right MB.

bancika

Ok, as soon as I get back home I'll post detection procedure. I really haven't got a clue. When invisible bitmap is created I set color depth to 32bit manually so it should stay like that on every computer  :icon_neutral:
The new version of DIY Layout Creator is out, check it out here


Gilles C

Quote from: bancika on September 23, 2006, 04:29:44 PM
I don't think it's a problem. See, I use color as handles (pointers) because they are basically the same format  (32bit number) as pointer is. So I use something like TComponent(Pointer(Bitmap.Pixels[x,y])) to access component that's under that mouse position, if any. So my guess is that somehow that hidden bitmap is screwed up (or reduced number of colors) so some handles become invalid

Bancika, don't you remember I already submited that right-click was not working a while ago, as did a couple of other users. I don't know if it worked after that for them, but it never worked on my 2 PCs.

That was your answer back then:

Quote from: bancika on June 17, 2006, 10:07:20 AM
For right click...it must work  ??? :icon_exclaim:
As for multi-select, I forgot to update something from single-select era. Only last selected component makes red wires although more than one component is selected. As I said before, when all items are selected those category tree nodes like [Resistors] stay unselected. Click on it and all other will becume unselected. I'll make Esc shortcut for unselect.
Component names turn light gray when Explorer is not in Focus, not when they are unselected.
Hope you get it now :)

And for Beer, if it works on some other PCs he tried, and not at home, there must be something that is not working with every computer since that time or even before.

beer


Gilles C

Oh, sorry. You're right, I wasn't clear. It was too late when I wrote it I suppose... :icon_redface:

What I meant is that since it worked when you installed it at work, and that it didn't work when you installed it at work, it can't be your fault. You know how to install and use it.

And since right clicking works every where but on the layout area in DIY-LC, it's not the fault of your computer either. It is the same on my computer. Right-click works on the component list on the right, but not on the layout area.

So it has to be the in the software, not in the computer.

And it must be in a routine for the layout that is not used in the component list. And I also meant that this problem was there a long time ago, it is not something new.

But the fact that it works on most computers is strange. What could be different in the computers where the right-click is not working, only with this program, and only in the layout area???

Gilles

beer

Ok , That makes more sense.
and i think youre right.
it must be in the software , but it's odd that i does'nt work on some computers ,
because colors should be the same worldwide.

i'll have a look at it as soon as i see the procedure/function.


bancika

Here's code for OnMouseDown event. MAsk is that invisible bitmap. All pixels that are not occupied by some component are colored black (integer value 0), and other pixels are colored with int value of pointer pointing to XML node containing that component (check .DIY file for XML structure).
  if Button = mbRight then
   begin
     if (Mask.Canvas.Pixels[X, Y] <> 0) and (XMLDoc.DocumentElement.ChildNodes.IndexOf(IXMLNode(Mask.Canvas.Pixels[X, Y])) >= 0) then
      begin
        for i := 0 to List.Items.Count - 1 do
         if (List.Items[i].Data <> nil) and (List.Items[i].Data = Pointer(Mask.Canvas.Pixels[X, Y])) then
         if List.Selected = List.Items[i] then
          begin
            ListNodeContextMenu(List, List.Selected, t, CompPopup);
            t := ClientToScreen(Point(X, Y));
            CompPopup.Popup(t.X, t.Y);
          end 
         else
          begin
            List.Items[i].Parent.Expand(False);
            List.Selected := List.Items[i];
            Refresh;
            Break;
          end;
      end;
     Exit;
   end;


and procedure I called here
procedure TMainForm.ListNodeContextMenu(aSender: TObject; aNode: TTreeNode;
  var aPos: TPoint; var aMenu: TPopupMenu);
begin
  {if aNode.Level = 0 then
    aMenu := nil
  else
    aMenu := CompPopup; }
  List.Selected := aNode; 

  ChangeValue.Enabled := (aNode.Level = 1) and (List.SelectionCount = 1) and (aNode.ImageIndex in [iResistor, iCapacitor, iElectrolyte, iDiode, iTransistor, iIC, iLineIC, iTrace, iPad, iTrimmer, iLed, iText, iTransformer, iSwitch]);
  Replace1.Enabled := (aNode.Level = 1) and (List.SelectionCount = 1);
  Rename1.Enabled := (aNode.Level = 1) and (List.SelectionCount = 1);
  Delete1.Enabled := True;
end;


hope it helps  :icon_wink:
Tnx
The new version of DIY Layout Creator is out, check it out here


bancika

Sorry for double posting, but a thing occured to me now. Few releases ago I changed "clicking-selection-popup" concept a bit. One right click on board does NOT open popup menu but only selects component below. If component is already selected popup menu is displayed. It was necessary change to do because it helps multiselect (holding Ctrl and right clicking on components on board)
Cheers
The new version of DIY Layout Creator is out, check it out here


beer

Ok , i think i found the problem.

on my computer it is the Antivirus program blocking the "XMLDocument" call as this is
(as far as i know) an internet based component , and therefor it is blocked by the antivirus.

Is there anybody who can verify this ???

bancika

possible, it is grouped in Internet components...I don't have any advanced AV...which one are you using. We'l try to find user with similar system and track it down.
Thanks for help!

edit: it's impossible, after all. I use XMLDocument all time, when loading/saving files, adding components, drawing board...It's the only memory structure I use for storing layout and component information. Must be something else  :icon_rolleyes:
The new version of DIY Layout Creator is out, check it out here


beer

i'm using "Panda" antivirus.

i'll try to find out if there is a possibillity to turn this of in the antivir prog.

i'll let you know.

beer

Ok , THis program has an "Protection against unknown virus" ,
So i guess it's the calling of the XML , and the typecasting which is trickering this blockade.

But , there is an setting called "Activate behavior analasys" or something like that.
(it's translated from Danish) turn that of , and then there is no problem.

Perhaps it's the same for some of the other guys/girls having problems with this ???

Gilles C -->> Can you verify ?

beer

Oh boy , it's good to have "right clicking".
No more messing around the explorer to find "Jumper 48"  :icon_lol:

bancika

are you saying AV is the problem  :icon_idea:
is there a way to put program on white list so everything as alowed?
The new version of DIY Layout Creator is out, check it out here


beer

On my computer it is.

Maybe it's the combination of XML-Calls, loops , and typecasting , pointers ,  that it sees as an potential threat.

i'm not sure , just my best guess

But i know for sure that it works for me now  :icon_biggrin:

beer

i don't think you can put it on a "White list" programwise , it's a manualy thing the user has to do , i think.

i'm not that much in to AV programs , i just saw the XML and startet thinking "internet" -->> "Proxy" -->> "AV".

but maybe you could try to fool the AV by putting the typecasting in another procedure , so you have the XML call in the first procedure and the typecasting in another ... don't know , just thinking out loud.

or maybe assign the popupcomponent for the XML-doc and control if the popup should actually perform.

ideas , ideas , some good most bad  :icon_rolleyes: