If your time is short and you want to go from Barcelona to Morocco, you should fly. Barcelona is a long way from Gibraltar, and if all you experience of Morocco is the "day trip from the ferry" you will be seeing the least attractive part of it (think of a trip to Tijuana, and that's all of Mexico that you ever see...).
Look for one of the discount airlines, there are more than a few that fly between Spain and Morocco. From Barcelona, try Atlas Blue, Click Air, and Ryan Air....there are probably a couple others.
We're going to be in Spain in a couple of weeks, and we're taking a quick side-trip to Morocco (we're flying from Madrid to Marrakech, then flying back from Fes to Paris). There are LOTS of options for discount flights to/from Morocco.