Saturday, 2012-01-28

*** tpb has joined #freeorion00:00
*** fixIt has joined #freeorion00:16
fixItwhen using GG::Connect() is it possible, and if it is possible...what is the correct syntax to have a function callback with a parameter?00:17
fixIt*Actually I meant argument00:51
CIA-3FreeOrion: eleazzaar * r4625 /trunk/FreeOrion/default/ship_hulls.txt: fixed the commenting out of krill sitrep that i did badly.00:58
*** VargaD has quit IRC01:02
*** bjorn2in has quit IRC01:25
GeofftheMediofixit: give an example?02:19
fixItOkay well I have a button widget that is set up with a GG::Connect to call a method that creates a modal pop up window. So I when the button is pressed and calls the method I want it to pass a string indicating which hot key it is like "HotKey.OpenChatWindow".02:21
fixItSo I was hoping there was a way to do GG::Connect(blah, &MapWnd::makewindow("this.hotkey"), this)02:22
fixItsomething like that so the call back is called with an argument specified02:22
fixItI have tried a ton of variations of syntax in hopes of getting it to work with no luck. From looking at the GG::Connect it makes templates of parameters so I thought it could work but thats only a guess02:23
GeofftheMediomake the signal you're connecting take a parameter02:24
GeofftheMedioboost::signal<void (const std::string&)> signal;02:24
GeofftheMedioGG::Connect(signal, &MapWnd::RunHotkeySelectDialog, this)02:25
GeofftheMedioand then when calling the signal,02:25
GeofftheMediosignal("HotKey.OpenChatWindow")02:25
fixItWait so the signal parameter would also be called with the callback function as well?02:27
fixItI am using the button->ClickedSignal btw02:27
GeofftheMedioif you don't want a custom signal type, then try using boost::bind to specify one of the parameters to the function you want to call at the time of signal connection02:28
GeofftheMedioalso, the "this" is actually a parameter.... I'm not sure if you can specify more than one or of arbitrary type02:28
GeofftheMedioa quick skim suggests not; use bind02:31
fixItAhh okay thanks, just looked up bind that does look like exactly what I need02:32
fixItHey Geoff do you program professionally?02:35
GeofftheMedionot really02:39
GeofftheMedioie. I've never had a job as a programmer02:39
GeofftheMediothough I have done programming as part of my work / school02:39
fixItWow I am shocked. Your clearly really talented and knowledgeable. Ah whats your major?02:48
GeofftheMedioI'm no lead programmer.02:48
GeofftheMedioengineering physics and medical physics02:49
fixItAh very cool. Well you basically are now right? So tzlaine is more responsible for the overall design then?02:54
GeofftheMediotzlaine knows more about designing software systems and adding new stuff... I more so extend stuff based on his examples02:57
*** StrangerDanger has quit IRC03:08
*** STalKer-Y has joined #freeorion04:51
*** STalKer-X has quit IRC04:51
fixItHey Geoff is it necessary to have 2 hot keys for zoom? right now + and e for zoom in, - and r for zoom out05:28
fixItCould only 1 be okay? Because zoom in and out are the only ones and it would be much simpler if there was only 1 for them.05:29
fixItactually nevermind I'll just make 2 configurable options for them05:34
GeofftheMedioit should be possible to have multiple key commands for every action06:03
GeofftheMediobut for the first version, you can do just one06:04
*** fixIt has quit IRC06:27
*** fixIt has joined #freeorion06:27
fixItIn the Options GUI I'm a little bit lost as to how I can display what the current hot key combination is for something..a Key is just an enum/int and then the ModKey is a class and neither have a ToString() that I have seen. Do you know of any better ways to do that or am I just going to have to make a massive if/else if translating each GG::Key into a string equivalent? I just tried boost lexical cast and the string comes out as G07:20
fixItGK_RIGHTBRACKET I dunno if thats acceptable?07:20
GeofftheMedioyou can pass "GGK_RIGHTBRACKET" to UserString, and add appropriate entries to eng_stringtable.txt07:21
fixItAh okay but either way I still have to add an entry for every single possible key right?07:22
GeofftheMediopossibly07:22
GeofftheMedionot all keys need to be acceptable for hotkey use, though07:23
GeofftheMedioand it might be possible to convert the enum into a char and use that in some cases07:23
fixItOh really which ones are not? As of now I have the basic functionality working allowing you to set and change hot keys..allowing anything you press.07:25
fixItfor enum to char would that go right to the correct char if its a single character or do I need to do something with ASCII to get the right value?07:25
GeofftheMedioI think there's some comment in the GG code about the enum values mapping to ascii07:26
GeofftheMediohave a search...07:26
GeofftheMedioor see how GG sets up what text to enter in an edit box if the user types something07:26
fixItOkay thanks I'll take a look at that. But are there any keys that should not be allowed to be mapped to something?07:28
GeofftheMedioprobably; I'm not sure which off the top of my head07:28
fixItalright if you think of any just let me know. You were right just read a comment by GG:Key saying their enum values are cleverly chosen to map to ascii thats perfect07:30
GeofftheMediosee how GG code does the conversion for Edit; it's probably also useful for you...07:31
*** bjorn2in has joined #freeorion07:31
fixItk07:32
fixItwhen you say conversion for edit, where exactly is this happening? Are you speaking of like the CUIEdit?07:54
GeofftheMediogg edit07:54
GeofftheMediolooks kinda complicated... not sure how it works myself07:54
fixItAh thanks. Yea indeed it does07:57
*** fixIt has quit IRC08:00
*** VargaD has joined #freeorion09:16
*** theTroy has quit IRC11:54
*** em3 has joined #freeorion12:14
*** theTroy has joined #freeorion12:53
*** theTroy has quit IRC13:01
*** theTroy has joined #freeorion13:01
*** em3 has joined #freeorion14:37
*** em3 has joined #freeorion14:38
*** bookwar1 has quit IRC15:56
*** StrangerDanger has joined #freeorion16:38
*** fixIt has joined #freeorion17:29
*** Mikoto_ has joined #freeorion18:48
*** Mikoto has quit IRC18:49
fixItSo for getting a Key Press from the user I am using the method I saw used in other places of the code for my modal window. ConfigureHotKeyModalWnd::KeyPress (GG::Key key, boost::uint32_t key_code_point, GG::Flags<GG::ModKey> mod_keys). Something I just noticed though is that when lets say I press Tab + y at the same exact time, instead of having one key press event that has y as its key and Tab as a mod key it ends up having 2 diff18:54
fixIterent KeyPress events with each event containing one of the keys I pressed. So if I press 3 keys at the same time I will get 3 separate key press events each containing 1 of the keys pressed.18:54
fixItSo I'm not sure how I will be able to allow a hot key with more than 1 key...or I guess I'd have to find a different way to grab key input?18:55
GeofftheMedioI don't think tab is a valid modkey18:55
GeofftheMediowhat happens if you press and hold shift, then press y ?18:55
fixItSame exact thing still. And you can't really hold a key, you sorta have to press them at the same time when setting them. Also kinda weird even if you just press y it will have a key that is y along with some flags set in the modkey18:58
GeofftheMedioreject keypress events that are also modkeys then18:59
GeofftheMedioso if you press and hold shift, you'll get a keypress with GGK_LSHIFT18:59
GeofftheMediocheck for that, and reject it18:59
GeofftheMediothen when y is pressed, you should get GGK_Y with the LSHIFT and SHIFT modkey flags set19:00
GeofftheMedioaccept that one19:00
fixItOkay that makes sense. So then doing things like that way it is not allowed to set a mod key as the only hot key for something?19:01
GeofftheMedioseems appropriate... otherwise it'll be impossible to specify that as a hotkey command without it grabbing the initial modkey keypress and treating it as the acutal desired keypress19:02
fixItSounds good. Uhm so now I understand how to allow a modkey + key, should multiple keys be allowed...because I'm not sure how that would work with the way keypress events work. Would I be correct in that only a single key or a modkey + key are allowed to be set as a hotkey?19:11
fixItwhen I say multiple keys I mean like G and H for instance19:12
GeofftheMedioyeah, I don't think CTRL + Q + C is necessary19:12
fixItOkay yea or that. So don't allow more than a mod key + key or just a key then? Should I specify this at the top of the options tab or something?19:13
GeofftheMediomultiple modkeys should be possible without much trouble...19:13
GeofftheMedioI don't think it's necessary to specify that only one keypress per command is accepted19:14
GeofftheMedioit should be apparent from the defaults and the fact that it exits the window after a single non-modkey keypress19:14
fixItby multiple modkeys do you mean multiple modkeys alone like shift and ctrl or do you mean multiple modkeys with a key? With a key I get how to make that work19:17
fixItOkay cool19:17
GeofftheMediowith a key19:17
GeofftheMediojust modkeys shouldn't do anything19:17
fixItAlright thanks19:17
GeofftheMedioanother thought: you could use keydown and keyup instead of keypress to capture the hotkey commands19:58
GeofftheMedioie only capture the result when getting a keyup event?  not sure if that would be awkward in practice...19:58
fixItAh okay I'll take a glance and see if that might make things easier or harder. Also when you set a hot key with lets say Left CTRL do you want it to only work with left control or should the right control work as well for it?20:03
GeofftheMediojust check for CTRL, not LCTRL or RCTRL independently20:03
fixItk20:05
*** em3 has quit IRC20:05
fixItSo enter and return should work the same way then?20:27
GeofftheMedioas eachother, or as something else?20:33
fixItLike if a hot key is CTRL and Enter, should CTRL and Return work automatically?20:36
*** theTroy has quit IRC20:38
GeofftheMediouhm... no opinion?  whatever's easiest for you, I guess20:40
fixItOkay i was looking and it would make things problematic and I would have to do things special to do that. So at least for now it won't work that way then. I only asked because before for like the end turn it was set up with CTRL Enter and CTRL Return but I have those set up as 2 different configurable options now20:41
GeofftheMedioshould be fine20:42
*** theTroy has joined #freeorion20:59
fixItk. two other weird things, so there are some keys that aren't even recognized as key press events like ` or even +, however the numpad + is a keypress event. so if anyone tries to set one of those keys as a hot key it will never get logged unless its on the numpad.21:02
GeofftheMedionormally + is = when shift is not pressed21:02
GeofftheMediodunno why ` wouldn't be a key21:03
GeofftheMedio` seems to work for me... it shows up as GGK_BACKQUOTE21:04
fixItAh okay well pressing the +/= key with or without shift does not make an event. Same with the `/~ key. However the numpad + always does.21:05
fixItYea I see the enums for the but IDK why those 2 keys literally don't generate the event at least for me, all the keys around them do though21:05
GeofftheMediohow are you determining this?21:07
GeofftheMedioif I put a breakpoint in GUI::HandleGGEvent in the case KEYPRESS section, then attach to FO and press = I get an event21:08
GeofftheMedioand pressing = when the focus is in an Edit control does type "=" so it must be sending events21:08
fixItWell for my modal window that has the KeyPress method that gets the event/signal I have a break point in there. If I press either of those the modal window will just stay there forever and the method is never entered, if I try other keys the method will be entered and the modal window will disappear and the hot key will then be set and work.21:08
GeofftheMediotry putting the breakpoint in GUI::HandleGGEvent under KEYPRESS and see if it catches it there21:09
fixItk21:10
fixItNope same exact thing. GUI::HandleGGEvent for KeyPress doesn't get entered for those keys but does for others. IDK if it has to do with me using a Release version maybe? But usually the code is still ran I just can't step through it or see values...21:14
fixItI guess I'll just ignore it for now then once  i finish it have your or someone else try it out and see if its just because of release?21:14
GeofftheMedioI'm building as release as well21:14
GeofftheMediothat shouldn't have anything to do with a particular key being functional or not21:15
GeofftheMediodo you have a standard us english keyboard?21:15
*** theTroy has quit IRC21:15
fixItUhm I assume so, its Logitech K200 which I bought in the U.S.. And from what I can tell its the same as all keyboards Ive used in the past. Maybe a bit smaller21:16
GeofftheMediodo those keys work normally to type into irc?21:17
GeofftheMedio` =21:17
fixIt` = yep21:17
GeofftheMedioweird... I dunno.21:17
fixItHmm yeah well hopefully they work for other people, I personally never plan on configuring those two keys as hot keys lol. Once I finish someone will have to verify they do21:19
GeofftheMediothere should probably be a cancel button on the modal dialog, in case someone doesn't have a functional keyboard...21:25
*** em3 has joined #freeorion21:32
*** theTroy has joined #freeorion21:33
*** theTroy has quit IRC21:50
*** theTroy has joined #freeorion22:04
*** Digit01 has joined #freeorion22:33
*** Mikoto_ is now known as Mikoto22:37
CIA-3FreeOrion: geoffthemedio * r4626 /trunk/FreeOrion/universe/ShipDesign.cpp: Grooming23:26
*** em3 has quit IRC23:46

Generated by irclog2html.py 2.5 by Marius Gedminas - find it at mg.pov.lt!