Difference between revisions of "Understanding camvc"

From ElphelWiki
Jump to: navigation, search
 
Line 9: Line 9:
 
===The Files===
 
===The Files===
 
'''camvc.html''' is the main file and contains all variables as well as the html code defining the layout.
 
'''camvc.html''' is the main file and contains all variables as well as the html code defining the layout.
 +
 
'''camvc_i18n.js''' contains the labels and help texts in multiple languages (currently: English, Russian and Chinese)
 
'''camvc_i18n.js''' contains the labels and help texts in multiple languages (currently: English, Russian and Chinese)
 +
 
'''camvc_ccam.js''' contains the acutal AJAX components that set/get parameters to/from the camera
 
'''camvc_ccam.js''' contains the acutal AJAX components that set/get parameters to/from the camera
  
Line 27: Line 29:
 
Now we add the actual html code to display the new checkbox just after the checkbox to ignore the streamer:
 
Now we add the actual html code to display the new checkbox just after the checkbox to ignore the streamer:
  
  <div id="idIgnoreStreamer_ALL" style="float:left;">
+
  &lt;div id="idIgnoreStreamer_ALL" style="float:left;"&gt;
   <div id="idIgnoreStreamer_LB" class="float_icon"></div>
+
   &lt;div id="idIgnoreStreamer_LB" class="float_icon"&gt;&lt;/div&gt;
   <div id="idIgnoreStreamer_CB" class="float_icon"></div>
+
   &lt;div id="idIgnoreStreamer_CB" class="float_icon"&gt;&lt;/div&gt;
  </div>
+
  &lt;/div&gt;
  <br/> // ADDED
+
  &lt;br/&gt; // ADDED
  <div id="idJP4_ALL" style="float:left;"> // ADDED
+
  &lt;div id="idJP4_ALL" style="float:left;"&gt; // ADDED
   <div id="idJP4_LB" class="float_icon"></div> // ADDED
+
   &lt;div id="idJP4_LB" class="float_icon"&gt;&lt;/div&gt; // ADDED
   <div id="idJP4_CB" class="float_icon"></div> // ADDED
+
   &lt;div id="idJP4_CB" class="float_icon"&gt;&lt;/div&gt; // ADDED
  </div> // ADDED
+
  &lt;/div&gt; // ADDED
  
  
Line 45: Line 47:
  
 
Add the following where you think it fits best (I added it below the definitions for IngoreStreamer)
 
Add the following where you think it fits best (I added it below the definitions for IngoreStreamer)
  {id:"idJP4_LB", t:"p",en:"JP4 Mode",
+
  {id:"idJP4_LB", t:"p",en:"JP4&lt;br/&gt; Mode",
  cn:"JP4 Mode",
+
  cn:"JP4&lt;br/&gt; Mode",
  ru:"JP4 Mode"},
+
  ru:"JP4&lt;br/&gt; Mode"},
 
  {id:"idJP4_ALL",t:"h",en:"Enable JP4 encoding mode for demosaicing images on client side",
 
  {id:"idJP4_ALL",t:"h",en:"Enable JP4 encoding mode for demosaicing images on client side",
 
  cn:"Please translate: Enable JP4 encoding mode for demosaicing on client side",
 
  cn:"Please translate: Enable JP4 encoding mode for demosaicing on client side",
 
  ru:"Please translate: Enable JP4 encoding mode for demosaicing on client side"},
 
  ru:"Please translate: Enable JP4 encoding mode for demosaicing on client side"},

Revision as of 06:06, 30 September 2008

I wanted to add a new checkbox to the camvc interface but had trouble getting a good overview of how this mainly AJAX driven tool that spreads sources over multiple files really works.

This tutorial is the result of my search and should help people that also want to add new features to understand the filestructure and functionality of camvc.

There already is a newer version of camvc called camvc2 that works slightly different and is not 100% complete yet. This tutorial applies to both versions as underlying layout is basically the same.


The Files

camvc.html is the main file and contains all variables as well as the html code defining the layout.

camvc_i18n.js contains the labels and help texts in multiple languages (currently: English, Russian and Chinese)

camvc_ccam.js contains the acutal AJAX components that set/get parameters to/from the camera


Adding JP4 Checkbox

So now we want to add a new feature to camvc: JP4 encoding mode right below the checkbox for color/monocrome, ignore streamer

Open camvc.html and scroll down to a block where a lot of variables are set. All variables are set in javascript as member of the document class:

I added the jp4 line just below playbackUpdated variable at line 274:

document.playbackUpdated=0;
document.jp4_mode=false;

Now we add the actual html code to display the new checkbox just after the checkbox to ignore the streamer:

<div id="idIgnoreStreamer_ALL" style="float:left;">
 <div id="idIgnoreStreamer_LB" class="float_icon"></div>
 <div id="idIgnoreStreamer_CB" class="float_icon"></div>
</div> 
<br/> // ADDED
<div id="idJP4_ALL" style="float:left;"> // ADDED
 <div id="idJP4_LB" class="float_icon"></div> // ADDED
 <div id="idJP4_CB" class="float_icon"></div> // ADDED
</div> // ADDED


The id _ALL is the help text displayed when you hover over the checkbox in the ?-Help Mode. The _LB id stands for label and is the actual text to display in the corresponding language The _CB id stands for checkbox

We now open camvc_i18n.js to set the label and help text:

Add the following where you think it fits best (I added it below the definitions for IngoreStreamer)

{id:"idJP4_LB", t:"p",en:"JP4<br/> Mode",
cn:"JP4<br/> Mode",
ru:"JP4<br/> Mode"},
{id:"idJP4_ALL",t:"h",en:"Enable JP4 encoding mode for demosaicing images on client side",
cn:"Please translate: Enable JP4 encoding mode for demosaicing on client side",
ru:"Please translate: Enable JP4 encoding mode for demosaicing on client side"},